fork download
  1. a, b, c = map(int, input().split())
  2. d = int(input())
  3.  
  4. hour = a + ((b + ((c + d) // 60)) // 60) % 24
  5. min = (b + ((c + d) // 60)) % 60
  6. sec = (c + d) % 60
  7.  
  8. print(hour,min,sec)
  9.  
Success #stdin #stdout 0.04s 9212KB
stdin
23 59 59
1
stdout
24 0 0