Under construction

Still being built. Things may change

Counting Banknotes

Time limit1sMemory limit1024 MB

Summary
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 68mm68\text{mm} tall, but the widths differ. The 1,000 won note is 136mm136\text{mm} wide, the 5,000 won note is 142mm142\text{mm}, the 10,000 won note is 148mm148\text{mm}, and the 50,000 won note is 154mm154\text{mm}. The width alone tells you which denomination a note is.

Sumin has NN 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 NN (1≤N≤1001\leq N\leq 100).

Each of the next NN lines contains the width and height of one banknote, separated by a space, in mm\text{mm}. 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.

Examples2

  1. Example 1

    Input
    1
    136 68
    
    Expected output
    1000
    
  2. Example 2

    Input
    4
    136 68
    142 68
    148 68
    154 68
    
    Expected output
    66000