#include <iostream>
using namespace std;
int main(void)
{
int a, b, c, d;
cin >> a >> b >> c >> d;
if (a > c) c += 24;
if (a == c && b == d) c += 24;
if (a == c && b > d) c += 24;
int start = a * 60 + b;
int end = c * 60 + d;
int temp = end - start;
int hour = temp / 60;
int minute = temp % 60;
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", hour, minute);
return 0;
}