#include <iostream>
using namespace std;
int main(){
int sh, sm, eh, em;
cin >> sh >> sm >> eh >> em;
int t = ((eh - sh) * 60 + (em - sm));
if(t <= 0) t += 24 * 60;
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", t / 60, t % 60);
return 0;
}