시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB143625440.909%

문제

Tehran municipality has set up a new charging method for the Congestion Charging Zone (CCZ) which controls the passage of vehicles in Tehran’s high-congestion areas in the congestion period (CP) from 6:30 to 19:00. There are plate detection cameras inside or at the entrances of the CCZ recording vehicles seen at the CCZ. The table below summarizes the new charging method.

The first time seen in the CP The last time seen in the CP Charge
6:30 to 10:00 6:30 to 16:00 24000
6:30 to 10:00 16:01 to 19:00 36000
10:01 to 16:00 10:01 to 16:00 16800
10:01 to 19:00 16:01 to 19:00 24000

Note that the first time and the last time that a vehicle is seen in the CP may be the same. Write a program to compute the amount of charge of a given vehicle in a specific day.

입력

The first line of the input contains a positive integer n (1 ≤ n ≤ 100) where n is the number of records for a vehicle. Each of the next n lines contains a time at which the vehicle is seen. Each time is of form <hour>:<minute>, where <hour> is an integer number between 0 and 23 (inclusive) and <minute> is formatted as an exactly two-digit number between 00 and 59 (inclusive).

출력

Print the charge to be paid by the owner of the vehicle in the output.

예제 입력 1

4
7:30
2:20
7:30
17:30

예제 출력 1

36000

예제 입력 2

1
12:13

예제 출력 2

16800

예제 입력 3

2
0:30
23:30

예제 출력 3

0