no tags 


This problem is the second of a set based on the same problem statement ("How many times the bell rang?"), specifically designed to work with different approaches and types of solutions.

In this first problem, your solution must be done using a recursive algorithm (see this Prezi, to get some ideas about this). You can submit a solution done without respecting this requirement, and eventually, the judge will inform "Accepted". In this case, your solution will be disqualify later, in a manual way by the problem setter. 

Problem Description: 

The priest of a church want to know the number of times the bell will ring during a specified time interval. This interval starts on h1:m1, and ends on h2:m2; where h1:m1 is the hour-minute of beginning, and h2:m2 is hour-minute of the end.

h1:m1 and h2:m2 are in the same day, and h1:m1 <=  h2:m2.



The input comes as a series of intervals, each in a different line. In each line there are four integers indicating hour and minute of the beginning and the end of the interval. The last line contains the values ​​0 0 0 0, indicating end of data and should not be processed.

In no case will be more than 100000 intervals in the input.



The output to show in each input case, will be an integer indicating the number of times that the bell will ring.




8 0 8 56
9 0 9 15
7 15 8 16
0 0 0 0



Author / Autor: Daniel Ambort


Added by:Coach UTN FRSF
Time limit:1s-10s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU