a,b,c,d = map(int, input().split()) start = a*60 + b end = c*60 + d if end > start: m = end - start else: m = 24*60 - start + end h = m // 60 min = m % 60 print("O JOGO DUROU %d HORA(S) E %d MINUTO(S)"%(h,min))