#00000A

trka

There are N racers with their current speeds known. Besides their speeds, you are also given the exact time of their start in hours, minutes and seconds. The race is being watched until a certain moment, also given in hours, minutes and seconds. At that moment all of the racers are on the track. Every racer starts alone at the start line and runs along a straight line with constant speed. The whole race (until that certain moment) is held in a single day.


You need to write a program that, considering the given data, finds the total number of racers that has no other racers in front of them at least one time during the race.


InputThe first line of standard input contains a number N (1 <= N <= 100), which represents the number of racers, followed by three integers H (0 <= H < 24), M (0 <= M < 60), S (0 <= S < 60). This is the time when the race stops being watched. In each of the next N lines there will be 1 real number V and three integers: H,M,S. The number V represents the speed of the current racer (in meters per second), and the other three numbers represent the hour, minute and second of that racer's starting time.

OutputTo the standard output you should write only the number of racers who had no other racers in front of them at least once during the race.

Input:
3 16 0 0
5 15 0 0
10 15 1 0
12 15 1 15

Output:
3

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.