#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int a, b, c, d;
cin >> a >> b >> c >> d;
int t1 = a * 60 + b;
int t2 = c * 60 + d;
if(t2 <= t1)
t2 += 24 * 60;
int ans = t2 - t1;
int h = ans / 60;
int m = ans % 60;
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)", h, m);
}