#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int a,b,c,d;
cin>>a>>b>>c>>d;
int e,f;
if(a==c&&b==d) e=24,f=0;
else{
if(b<=d) e=(c-a+24)%24, f=d-b;
else e=(c-a-1+24)%24,f=60+d-b;
}
//if(e==0) e=24;
printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)",e,f);
return 0;
}