Problem D
Stigagjöf
Languages
en
is
The contest this year will be somewhat different from previous contests. One of the largest changes (aside from cuter problem authors than ever before) is the scoring.
For each problem you can receive from $0$ to $100$ points. The more points, the better. Each team may send in as many solutions as they like. If many solutions are submitted to a single problem, the solution that got the most points is the one that counts, and determines the points for that problem.
The total points for a team is the sum of points for each problem. Teams are ordered in decreasing order by total points. If two teams get the same number of points, the team that got this point total earlier goes above on the scoreboard.
In this problem you neither need to consider total points nor time. You are given the name of a problem, then a list of solutions that a team has submitted and are supposed to find the points that team get for the problem.
Input
The first line of the input contains the name of the problem in question. The second line contains an integer $1 \leq N \leq 100$ wich denotes the number of submitted solutions. Then there are $N$ lines. Each of these lines denotes a submission made by the team and contain an integer $1 \leq t \leq 360$, saying what minute the submission was made, the name of the problem it was submitted to, and finally an integer $0 \leq s \leq 100$ which denotes how many points the submission got. The names of the problems will only contain lower case English letters and digits, the submissions are also in increasing order by time.
Output
A single line with the points that the team gets for the problem in question.
Explanation of Sample Inputs
In the first sample the problem in question is stigagjof and the team has submitted three solutions. Out of these solutions the second one got the highest number of points, $100$. This is thus the number of points the team gets for this problem, and is thus the answer.
In the second sample the problem in question is budarkassi2. The team has submitted two solutions and out of those the better one got $60$ points.
In the third sample the problem in question is budarkassi1. The team has made no submissions, so the team gets no points, so the answer is $0$.
Scoring
The solution will be tested on differently hard input data and the data is divided into groups as shown in the table below. The solution will then be scored according to how many groups are solved.
|
Group |
Points |
Constraints |
|
1 |
50 The only problem in the input is the one being asked about |
|
|
2 |
50 |
| Sample Input 1 | Sample Output 1 |
|---|---|
stigagjof 3 10 stigagjof 50 15 stigagjof 100 33 stigagjof 50 |
100 |
| Sample Input 2 | Sample Output 2 |
|---|---|
budarkassi2 7 10 stigagjof 50 15 stigagjof 100 20 budarkassi2 60 25 budarkassi1 40 33 stigagjof 50 35 budarkassi1 100 40 budarkassi2 40 |
60 |
| Sample Input 3 | Sample Output 3 |
|---|---|
budarkassi1 1 2 stigagjof 100 |
0 |
