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?
H1,M1,H2,M2,K=map(int, input().split())
if H1 == 0:
  H1 = 24
if H2 == 0:
  H2 = 24
hour = H2-H1
print(H1)
print(H2)
if M1 > M2:
  hour -=1
  minutes = abs(M2-M1)
else:
  minutes = M2-M1

print(hour*60+minutes-K)

H1,M1,H2,M2,K=map(int, input().split())

if H1 > H2:
  hour = H2+(24-H1)
else:
  hour = H2-H1

if M1 > M2:
  hour -= 1
  minutes = M2+(60-M1)
else:
  minutes = M2-M1
print(hour*60+minutes-K)
