#K38242. Maximum Revenue Calculation

    ID: 26155 Type: Default 1000ms 256MiB

Maximum Revenue Calculation

Maximum Revenue Calculation

You are given information about several test cases. In each test case you are provided with a number of different books, their corresponding quantities and prices. Your task is to compute the maximum revenue obtainable by selling all the books. The revenue for a test case is calculated using the formula:

\( \text{Revenue} = \sum_{i=1}^{N} q_i \times p_i \)

where \(q_i\) is the quantity and \(p_i\) is the price of the i-th book. Each test case is independent and you should output the revenue for each test case on a new line.

inputFormat

The input is read from stdin and has the following format:

  1. The first line contains an integer \(T\), the number of test cases.
  2. For each test case, the first line contains an integer \(N\), the number of different books.
  3. The second line contains \(N\) space-separated integers representing the quantities of each book.
  4. The third line contains \(N\) space-separated integers representing the prices of each book.

If \(N = 0\), the corresponding second and third lines will be empty.

outputFormat

For each test case, output the computed revenue on a separate line in stdout.

## sample
1
3
2 1 4
5 3 2
21

</p>