Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

EIUCRD - Total Credits

Khanh is asking for your help in calculating his total credits. He gives you the list of courses and numbers of credits of each course and the list of grades for each course.

Only courses with grade larger than or equal to 50 are counted. Khanh needs to know how many credits he gained

Input

-      The first line contains one integer N - the number of courses to be calculated.

-      The N next lines each contains a string S and an integer c where S is the ID of the course and c is the number of credits of that course.

-      Each line in the last N lines contains an integer G and a string S where G is the grade of course S.

Output

Print out only one line containing the total number of credits that Khanh gained.

Sample

 

Input

Output

5

CSE101 4

CSE102 4

CSE103 1

CSE104 3

CSE105 2

70 CSE101

80 CSE102

60 CSE105

40 CSE104

10 CSE103

10


Added by:Ha Minh Ngoc
Date:2021-03-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:CSHARP C++ 4.3.2 CPP CPP14 CPP14-CLANG FSHARP GO JAVA JS-MONKEY NODEJS PHP PYTHON PYPY PYPY3 PYTHON3 RUBY SQLITE SWIFT VB.NET
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.