#include <iostream> using namespace std; int a,b,c,d,e,f; int main () { cin>>a>>b>>c>>d; if (b>d) { f=60-b+d; } else { f=d-b; } e=c-a; cout<<e<<f<<endl; return 0; }