H,M,S = map(int, input().split()) t = int(input()) m,s = divmod(t+S,60) h,m = divmod(m+M,60) if H+h > 23: print(f'{(H+h)%24} {m} {s}') else: print(f'{H+h} {m} {s}')
주의 : 현재 시간에 걸리는 시간을 시,분,초 단위로 더해서 나눠야 함. 주어진 시간을 나누는 게 아님.