#include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d; cin>>a>>b>>c>>d; int s=(c*60+d)-(a*60+b); cout<<s; return 0; }