1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include <bits/stdc++.h>
using namespace std;
int main()
{
	vector<int>term={0,2880,4320,5760,7200,10020};
	int x,d,h,m;
	cin>>x>>d>>h>>m;
	int poc=(d-23)*1440+h*60+m;
	if(d==29&&h>=3)
		term[x]+=60;
	cout<<term[x]-poc<<"\n";
}