All problems

A Weighted Score in One Line

mediumPythonNumPyDot Product

Riverbend Supply rates each supplier on several criteria — price, reliability, lead time — and those criteria do not matter equally. The buying team agrees a weight for each one, and a supplier's headline figure is what the weighted criteria come to altogether. The weights arrive alongside the scores in the same criterion order. Use them exactly as they are given: they are not to be rescaled, adjusted or made to add up to anything in particular.

Task: Print the supplier's headline figure — every criterion's score counted according to its own weight, all brought together into one number.

Input

Three lines. The first holds a single integer n, the number of criteria. The second holds the n scores on one line, separated by single spaces. The third holds the n weights, on one line, in the same criterion order.

Output

One line holding the headline figure with exactly two digits after the decimal point.

Example:

Input:
3
80 90 70
0.5 0.3 0.2

Output:
81.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…