Problem D
Fast Food Prizes
Around regional contest time, the Canadian branch of a
popular fast food restaurant usually runs a game to promote its
business. Certain food items provide stickers, and certain
collection of different stickers can be converted to cash
prizes. If a prize requires sticker types
On your road trip to the regional contest, your coach forced you to eat at this restaurant and collected all the stickers together. How much cash can your coach claim?
Input
The input consists of multiple test cases. The first line of
input is a single integer, not more than
Output
For each case, display on a single line the total value of the cash prizes that can be claimed.
Sample Input 1 | Sample Output 1 |
---|---|
3 2 10 3 1 2 3 100 4 4 5 6 7 200 2 3 1 4 5 2 2 1 3 4 3 6 2 1 2 100 3 3 4 5 200 1 6 300 1 2 3 4 5 6 3 6 2 1 2 100 3 3 4 5 200 1 6 300 1 2 0 4 5 6 |
500 2500 1900 |