#include <iostream>
#include <cstdio>
using namespace std;
int main ()
{
int a, b, c, d;
cin >> a >> b >> c >> d;
//本质就是判断负值的情况,可以直接加一个偏移量
if (c < a) c += 24;
if (c == a && d < b) c += 23, d += 60;
int t = (c * 60 + d) - (a * 60 + b);
//if(t <= 0) t += 24 * 60; //精辟
int h = 0, m = 0;
h = t / 60, m = t % 60;
if (h == 0 && t == 0) h = 24;
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)", h, m);
return 0;
}