https://www.acmicpc.net/problem/2525
h,m=map(int,input().split()) n=int(input()) sum=m+n h+=sum//60 sum%=60 h%=24 print("%d %d" % (h,sum))