p=eval(input().replace(" ","+"));print((p-24if p>23else p))
print((eval(input().replace(" ","+"))%24))
p = eval(input().replace(" ", "+"))
print((p - 24 if p > 23 else p))

print((eval(input().replace(" ", "+")) % 24))

-p = eval(input().replace(" ", "+")) -print((p - 24 if p > 23 else p)) +print((eval(input().replace(" ", "+")) % 24))