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