Contest results#11078

Contest results

1 second
128 megabytes
Very easy

The members of the ship decided to take part in the programming Olympiad. The competition is held according to the ICPC rules.

You are given a sequence of the participant's submissions in the order in which the participant did them. For each sending, the moment of time at which it was made, the task number, and the verdict of the testing system are known. Find the number of accepted tasks by the participant and his total penalty.

The participant could send the task even after it had been accepted. The penalty for the task is calculated according to the formula t + 20 \cdot k, where is the time of the first successful submission of the task in minutes, is the number of incorrect attempts before the first successful submission, excluding CE. The total penalty is calculated as the sum of penalties for all accepted tasks. There is no penalty for not solved tasks.

Input

The first line contains one integer (1 \le n \le 10^5) - the number of participant's submissions. The next lines contain descriptions of submissions. The description of the -th submission is given in the format "HH:MM X V", where:

  • "HH:MM" (0 \le HH \le 4, 0 \le MM \le 59) - submission time. Two digits indicating the number of hours and two digits indicating the number of minutes since the start of the contest.

  • "X" - task number, capital latin letter from 'A' to 'Z'.

  • "V" - verdict, value from the set OK, WA, TL, ML, RE, CE, SV. The OK verdict corresponds to an accepted submission.

Output

Print two integers - the number of accepted tasks and the total penalty.

Examples

Example 1

Loading
Loading