#include <iostream>
using namespace std;
int main()
{
int A, B, C, D;
cin >> A >> B >> C >> D;
if (A > C) C += 24; // 明显是打通宵了
if ((A == C) && (B >= D)) C += 24; // 明显也是打通宵了
int minutes = (C * 60 + D) - (A * 60 + B);
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)", minutes / 60, minutes % 60);
}