eolymp
bolt
Try our new interface for solving problems
Problems

Contest results

Contest results

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 submitions in the order in which the participant did them. For each sending, the moment of time at which it was made, the number of the task, and the verdict of the testing system are known. Find the number of tasks submitted by the participant and his total penalty.

The participant could send the task even after it had been submitted. The penalty for the task is calculated according to the formula t + 20 * k, where t is the time of the first successful submission of the task in minutes, k is the number of incorrect attempts before the first successful submition, 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 n (1n105) - the number of participant's submitions. The next n lines contain descriptions of submitions. The description of the i-th submition is given in the format "HH:MM X V", where:

  • "HH:MM" (0HH4, 0MM59) - submition 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 submition.

Output

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

Time limit 1 second
Memory limit 128 MiB
Input example #1
7
00:05 A RE
00:07 A WA
00:09 A TL
00:29 B OK
00:55 D WA
01:08 A CE
01:10 A OK
Output example #1
2 159
Source 2020 Cycle of Internet Olympiads for schoolchildren, Second team contest, October 25, Problem B