#C6089. Lowest Total Price

    ID: 49810 Type: Default 1000ms 256MiB

Lowest Total Price

Lowest Total Price

You are given two lists of prices for N products from two different stores. For each product, you must choose the lower price between the two stores. The problem can be summarized by the formula:

\( total = \sum_{i=1}^{N} \min(p_i^1, p_i^2) \)

Your task is to compute and print the lowest possible total price for buying all products.

inputFormat

The input is given via standard input (stdin) as follows:

  1. The first line contains an integer (N), the number of products.
  2. The second line contains (N) space-separated integers, representing the prices of the products in the first store.
  3. The third line contains (N) space-separated integers, representing the prices of the products in the second store.

outputFormat

Print a single integer to standard output (stdout) representing the lowest total price required to purchase all products.## sample

3
10 20 30
15 25 10
40