1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
using namespace std;

int main() {
int x, d, h, m;
cin >> x >> d >> h >> m;
int d1;
if(x==1) d1=24;
if(x==2) d1=25;
if(x==3) d1=26;
if(x==4) d1=27;
if(x==5) d1=29;
int h1 = 23;
int m1 = 59;
int minuty = 0;
minuty = minuty   + (d1 - d) * 1440;
minuty  = minuty+ (h1 - h) * 60;
minuty = minuty + (m1 - m);
if(x == 5) {
   if(d < 29 || (d == 29 && h < 2)) {
    minuty = minuty - 60;
    }
    }
	minuty=minuty+1;
	cout << minuty;

    return 0;
}