fork download
  1. h,m,s=map(int,input().split())
  2.  
  3. s2=int(input())
  4.  
  5. x=s+s2
  6.  
  7. if(x>=60):
  8.  
  9. m+=x//60
  10.  
  11. x%=60
  12.  
  13. if(m>=60):
  14.  
  15. h+=m//60
  16.  
  17. m%=60
  18.  
  19. if(h>=24):
  20.  
  21. h-=24
  22.  
  23. print(h,m,x)
Success #stdin #stdout 0.02s 10028KB
stdin
0 0 0
500000
stdout
114 53 20