#include<bits/stdc++.h>
using namespace std;
int num(string s)
{
int r=0;
int h=(s[0]-'0')*10+(s[1]-'0');
int m=(s[3]-'0')*10+(s[4]-'0');
int e=(s[6]-'0')*10+(s[7]-'0');
r=h*60*60+m*60+e;
return r;
}
int main()
{
string s,s1;
cin>>s>>s1;
cout<<num(s)-num(s1)<<endl;
}