In this problem, we use the 24-hour clock.  Takahashi gets up exactly at the time H_1 : M_1 and goes to bed exactly at the time H_2 : M_2. (See Sample Inputs below for clarity.) He has decided to study for K consecutive minutes while he is up. What is the length of the period in which he can start studying?
print
a, b, c, d, e= map(int, input().split()) 
print((c-a)*60+d-e-b)