CAMPA2 - CAMPANAS2

no tags

Background:

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.

Input

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.

Output

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

Example:

Input

`8 0 8 569 0 9 157 15 8 160 0 0 0`

Output

`415`

Author / Autor: Daniel Ambort

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