#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int A,B,k;
cin>>A>>B;
if(A==B){
k=24;
}else if(B>A){
k=B-A;
}else if(A==0){
k=B;
}else{
k=24-A+B;
}
printf("O JOGO DUROU %d HORA(S)",k);
return 0;
}