M = int(eval(input()))

print((24 - M + 24))

m = int(eval(input()))



print((24-m+24))
M = int(eval(input()))
print((24 - M + 24))

m = int(eval(input()))
print((24 - m + 24))

-M = int(eval(input())) -print((24 - M + 24)) +m = int(eval(input())) +print((24 - m + 24))