Earned Credits

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Hà Minh Ngọc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Khanh is asking for your help in calculating his total credit. 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 grades larger than or equal to ~50~ are counted. Khanh needs to know the 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.

  • The last ~N~ lines each contains an integer ~G~ and a string ~S~ where ~G~ is the grade of the course that has ID of ~S~.

Output

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

Sample Input

5
CSE101 4
CSE102 4
CSE103 1
CSE104 3
CSE105 2
70 CSE101
80 CSE102
60 CSE105
40 CSE104
10 CSE103

Sample Output

10

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.