x, d, h, m = list(map(int,input().split()))
if x == 5:
ot = 0
if d == 27:
ot = 60 * (h-12) + m
elif d == 28:
ot = 720 + 60*h + m
else:
if h<2:
ot = 2160 + h*60 + m
else:
ot = 2280 + (h-3)*60 + m
print(3540 - ot)
else:
dp = 22 + x
ot = 0
if d == dp:
ot = 60 * (h-12) + m
else:
ot = 720 + 60*h + m
print(2160 - ot)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | x, d, h, m = list(map(int,input().split())) if x == 5: ot = 0 if d == 27: ot = 60 * (h-12) + m elif d == 28: ot = 720 + 60*h + m else: if h<2: ot = 2160 + h*60 + m else: ot = 2280 + (h-3)*60 + m print(3540 - ot) else: dp = 22 + x ot = 0 if d == dp: ot = 60 * (h-12) + m else: ot = 720 + 60*h + m print(2160 - ot) |
English