#include <iostream>
using namespace std;
int main() {
int a, b, c, d, x, y;
cin >> a >> b >> c >> d;
x = c - a;
y = d - b;
if (!x && !y){
x += 24;
}
if (y < 0) {
y += 60;
x--;
}
if (x < 0) {
x += 24;
}
cout << "O JOGO DUROU " << x << " HORA(S) E " << y << " MINUTO(S)" << endl;
return 0;
}