Counting Banknotes
Time limit1sMemory limit1024 MB
Given N banknote widths and heights, the task is to sum the value of each note, where width identifies the denomination.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
South Korean banknotes come in four denominations: 1,000 won, 5,000 won, 10,000 won, and 50,000 won. Every banknote is tall, but the widths differ. The 1,000 won note is wide, the 5,000 won note is , the 10,000 won note is , and the 50,000 won note is . The width alone tells you which denomination a note is.
Sumin has Korean banknotes. Using a paper size measuring machine, Sumin measured the width and height of each note. Find the total value of the banknotes Sumin has.
Input
The first line contains an integer ().
Each of the next lines contains the width and height of one banknote, separated by a space, in . Every width and height is an integer, and each pair is the width and height of a 1,000 won, 5,000 won, 10,000 won, or 50,000 won note.
Output
Print the total value of the banknotes Sumin has.