atcoder#ABC246C. [ABC246C] Coupon
[ABC246C] Coupon
Score : points
Problem Statement
There are items in a shop. For each , the price of the -th item is yen (the currency of Japan).
Takahashi has coupons. Each coupon can be used on one item. You can use any number of coupons, possibly zero, on the same item. Using coupons on an item with a price of yen allows you to buy it for yen.
Print the minimum amount of money Takahashi needs to buy all the items.
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
5 4 7
8 3 10 5 13
12
By using coupon on the -st item, coupon on the -rd item, and coupons on the -th item, Takahashi can:
- buy the -st item for yen,
- buy the -nd item for yen,
- buy the -rd item for yen,
- buy the -th item for yen,
- buy the -th item for yen,
for a total of yen, which is the minimum possible.
5 100 7
8 3 10 5 13
0
20 815 60
2066 3193 2325 4030 3725 1669 1969 763 1653 159 5311 5341 4671 2374 4513 285 810 742 2981 202
112