Think the contest scoreboard is wrong? Here is your chance to produce the correct rankings.
Contestants are ranked first by the number of problems solved (more is better). Ties are broken by total penalty time, where less penalty time ranks higher. If two or more contestants are tied in both problems solved and total penalty time, they are listed in order of increasing contestant (team) number.
A problem is considered solved by a contestant if any of that contestant's submissions for the problem was judged correct. The penalty time for a single problem is the number of minutes until the first correct submission for that problem was received, plus 20 minutes for each incorrect submission received before that correct submission. Unsolved problems incur no penalty time. A contestant's total penalty time is the sum of the penalty times of all the problems they solved.
The input is a snapshot of the judging queue, containing entries in which some or all of contestants 1 through 100 attempt problems 1 through 9. Each line of input consists of three numbers and a letter in the format
contestant problem time L
where L is one of C, I, R, U, or E, standing for a Correct, Incorrect, clarification Request, Unjudged, or Erroneous submission respectively. The last three (R, U, E) do not affect scoring.
The lines of input are given in the order in which the submissions were received.
Print the scoreboard sorted as described above. Each output line contains a contestant number, the number of problems that contestant solved, and the contestant's accumulated total penalty time, separated by single spaces. Because not all of contestants 1 through 100 are actually participating, print only the contestants that have made at least one submission.