All problems

The Average Miss

easyPythonML MetricsRegression

Northwind Grocers forecasts tomorrow's demand for every line it stocks, and by the following evening the real figure is known. The buying team wants the size of a typical miss expressed in the same unit as the goods — crates, not percentages, not anything squared — because crates are what they can hold against a pallet.

Task: Print the average size of a day's miss.

Input

The first line holds an integer n, the number of days. Each of the next n lines holds two numbers separated by a single space: the true demand first, the forecast second. Either may be whole or decimal.

Output

One line: the average miss with exactly two digits after the decimal point. A forecast three crates over and a forecast three crates under are misses of the same size, so the answer is never negative. Print 0.00 when every forecast was exact.

Example:

Input:
3
10 12
20 18
30 33

Output:
2.33

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…