fork download
  1. H, M = map(int, input().split())
  2. T = int(input())
  3. total = H*60+M+T
  4. if total > 24*60:
  5. total-=24*60
  6. print(total//60, total%60)
Success #stdin #stdout 0.04s 9716KB
stdin
23 59
1
stdout
24 0