13989 - Roommate's Alarm Clock   

Description

Hank's roommate, Noah, sets an alarm clock every day, but the alarm only wakes up Hank and cannot wake up Noah.

This annoys Hank. Now, given Hank's bedtime and the alarm set by Noah, please help Hank calculate how much sleep he can get in total for one day. ( This means Hank won't sleep for more than a day. )

 

( Note :

In the first sample test case, Hank slept from 23:59 today to 00:34 the next day.

In the third sample test case, Hank fell asleep at the same time the alarm went off, so Hank didn't sleep at all. )

Input

There are two lines of input.

The first line is in the format h1:m1, representing Hank's bedtime.

The second line is in the format h2:m2, representing the alarm set by Noah.

You can assume that h1, m1, h2, and m2 are all 2-digit integers.

(Note: you can use scanf("%d:%d\n%d:%d").)

Constraints:

  • 0 <= h1, h2 <= 23, 0 <= m1, m2 <= 59

Output

Please output an integer, representing how many minutes Hank can sleep in one day.

(Note: Hank won't wake up naturally; he will only wake up when Noah's alarm goes off.)

Please remember to print "\n" at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss