a, b = list(map(int, input().split()))

print((a + b if a + b < 24 else (a + b - 24 if a + b > 24 else 0)))
A, B = list(map(int, input().split()))

x = A + B

print((x if x < 24 else (0 if x == 24 else x - 24)))
a, b = list(map(int, input().split()))
print((a + b if a + b < 24 else (a + b - 24 if a + b > 24 else 0)))

A, B = list(map(int, input().split()))
x = A + B
print((x if x < 24 else (0 if x == 24 else x - 24)))

-a, b = list(map(int, input().split())) -print((a + b if a + b < 24 else (a + b - 24 if a + b > 24 else 0))) +A, B = list(map(int, input().split())) +x = A + B +print((x if x < 24 else (0 if x == 24 else x - 24)))