#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int a, b, c, d;
cin >> a >> b >> c >> d;
int start = a * 60 + b;//转化为分钟不需要考虑借位情况
int end = c * 60 + d;
if( start < end) printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n",(end - start) / 60,(end - start) % 60);
else printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n",(1440 - start + end) / 60,(1440 - start + end) % 60);
return 0;
}