#include<bits/stdc++.h>
using namespace std;
int main(){
	string a,b;
	int h1,m1,a1,a2,h2,m2;
	cin>>a>>b;
	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');
	a2=(b[6]-'0')*10+(b[7]-'0');
	cout<<h1*3600+m1*60+a1-(h2*3600+m2*60+a2);


	return 0;
}

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