#include<bits/stdc++.h>
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;
    int h1,m1,a1,h2,m2,b1;
    h1=(a[0]-'0')*10+(a[1]-'0');
    m1=(a[3]-'0')*10+(a[4]-'0');
    a1=(a[6]-'0')*10+(a[7]-'0');
    h2=(b[0]-'0')*10+(b[1]-'0');
    m2=(b[3]-'0')*10+(b[4]-'0');
    b1=(b[6]-'0')*10+(b[7]-'0');
    cout<<h1*3600+m1*60+a1-(h2*3600+m2*60+b1);
	return 0;
}

/**************************************************************
	Problem: 1101
	User: wangchenyu
	Language: C++
	Result: Accepted
	Time:17 ms
	Memory:2076 kb
****************************************************************/