import sys
h,m=map(int,input().split()) #두 수 입력 받음
t=int(input()) #필요한 시간 입력 받음
if h<0 or h>23 and m<0 or m>59 and t<0 or t>1000:
sys.exit() #조건에 맞지 않으면 종료
h = (h + ((m + t)//60)) % 24
m = (m + t)%60
print(h,m)
질문은 happyoon913@gmail.com으로 보내주세요.