#C2833. Weighted Average Daily Consumption

    ID: 46193 Type: Default 1000ms 256MiB

Weighted Average Daily Consumption

Weighted Average Daily Consumption

You are given data that represents the daily consumptions and corresponding weights for a number of days. Your task is to compute the weighted average consumption using the formula:

[ \text{Weighted Average} = \frac{\sum_{i=1}^n c_i \times w_i}{\sum_{i=1}^n w_i} ]

where (c_i) represents the consumption on day (i) and (w_i) represents the weight for day (i). The result should be rounded to six decimal places. This problem tests your ability to handle basic arithmetic operations and proper formatting of the output.

inputFormat

The input is read from standard input (stdin) and consists of three lines:

  1. The first line contains an integer (n) representing the number of days.
  2. The second line contains (n) space-separated integers representing the daily consumptions.
  3. The third line contains (n) space-separated integers representing the weights for each day.

outputFormat

Print the weighted average rounded to six decimal places to standard output (stdout).## sample

3
10 20 30
1 2 3
23.333333

</p>