11677

#include <iostream>

using namespace std;

int main()
{
	int h1,h2,m1,m2;
	int a,b;
	while(cin>>h1)
	{
		cin>>m1>>h2>>m2;
		if(h1+h2+m1+m2==0)
		break;

		a = h1*60+m1;
		b = h2*60+m2;
		if(b<a)
		{
			cout<<(24*60)-a+b<<"\n";
		}
		else
		{
			cout<<b-a<<"\n";
		}
	}

	return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *