"Heave-ho!"
Geppetto has changed jobs and now works in a workshop where he spends his entire workday hammering nails. To keep himself entertained, there is a TV running constantly in the workshop. Unfortunately, Geppetto's productivity depends directly on his mood, which in turn depends on what is being shown on TV at the moment. However, while Geppetto is hammering a nail, he does not pay attention to the TV, so his work speed is determined only by what was on TV at the moment when he started hammering that nail. After finishing a nail, he always glances at the TV (his mood naturally changes), and then he can either immediately start hammering the next nail or take a short break to watch TV for a few seconds or even minutes.
Geppetto begins work exactly at o'clock. Starting from o'clock he takes a lunch break. If just before lunch he wants to start hammering a nail but realizes that he will not be able to finish this work before the break, he does not start it. Similarly, at o'clock he resumes work, and at o'clock he goes home. This means that at 9:00:00 (as well as at 14:00:00) he can already start hammering a nail. For example, if at 12:59:59 (similarly, at 17:59:59) he wants to start hammering a nail, and it will take him second, he manages to finish it before lunch (or before the end of the workday), but if it takes seconds, he does not start.
The TV program schedule and its effect on Geppetto are known. It is required to create a work schedule and short breaks for Geppetto so that he can hammer the maximum possible number of nails in one workday.
The input file contains the TV program schedule from 9:00:00 to 18:00:00 in the following format. The first line contains the number — the number of TV programs during this period (1 \leq N \leq 32400). Each of the next lines describes one program: first, the start time in the format HH:MM:SS ( — two digits for hours, — two digits for start minutes, — two digits for start seconds). Then, after one or more spaces, the number T_i — the time in seconds that Geppetto will spend hammering one nail if he sees this program on TV beforehand (1 \leq T_i \leq 32400).
The programs are listed in chronological order. The first program always begins at 09:00:00. Assume that the last program ends at 18:00:00.
The first line of the output file must contain the maximum number of nails Geppetto can hammer in one workday.
Example 1
In the first example, Geppetto hammers one nail every hour.
In the second example, during the first half of the day, he hammers one nail every half hour, but at 12:30:00 he does not start, instead waiting for 12:59:31, and manages to hammer nails before lunch. From to o'clock, nails are hammered, and then one nail per hour.