All problems

Predicting From a Fitted Line

easyPythonLinear Regression

The fuel rule Kestrel Freight fitted last quarter is now in the quoting screen. Dispatch types in tomorrow's runs and wants the cost the rule expects for each one. Nothing is being learned here: the rule arrives already fitted, the deliveries it was learned from are long gone, and the screen only has to apply it.

Task: Print the fuel cost the fitted line predicts for each distance.

Input

The first line holds two numbers separated by a single space: the slope of the line, then its intercept. The second line holds one integer n, the number of runs to quote, where 1 <= n <= 1000. Then come n lines, each holding a single distance.

Output

n lines, one per run, in the order the distances arrived. Each line holds only the predicted cost rounded to 2 decimal places — no label, no units. Print whatever the line gives, including a negative number: the rule is not clipped or rounded to whole money.

Example:

Input:
2 1
4
0
1
2
3

Output:
1.00
3.00
5.00
7.00

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…