SPOJ | 프로그래밍의 벗 PivotOJ
PivotOJ

SPOJ

시간 제한: 1000ms메모리 제한: 128MB출처: CHC 2003 Regional Competition - JuniorsBOJ 3226

문제

Ivica is worried about amount of money he spend for phone bill for surfing on Internet. 

One minute of surfing in the period between 7:00 and 19:00 costs 10 cents, and in period between 19:00 and 7:00 costs 5 cents (the price is the same for all days in the months). 

Start and end of one connection to Internet is always rounded to minute (not seconds), and one connection lasts at most 60 minutes. 

You are given a list of connections, write a program which will calculate the total amount of money spent on Internet. 

입력

In the first line of input file there is integer N, number of connections, 1 ≤ N ≤ 100. 

In each of next N lines there is description of one connection, in the following format: 

HH:MM DD 

with HH:MM denotes hour and minute of start of connection, and DD denotes for duration of connection (in minutes, maximum 60). Between MM and DD there is one space character. 

If hour or minute of start of connection or duration is one-digit number, then there is a leading zeroin front of that number. 

Times are denoted from 00:00 till 23:59. 

출력

You have to write total amount of money (in cents) in only line in output file. 

 

예제

예제 1

입력
2
11:02 11
15:30 01
출력
120

예제 2

입력
3
20:05 12
06:45 30
13:08 15
출력
435

예제 3

입력
5
00:00 05
06:47 35
11:30 18
18:33 60
23:59 22
출력
1035
코드를 제출하려면 로그인하세요.