#include <iostream>
using namespace std;
int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int y , m;
cin >> y >> m;
if(y % 400 == 0 || ( y %4 == 0 && y % 100 != 0 ) ){
days[2] = 29;
}
cout << days[m];
}
y,m=map(int,input().split())
match m:
case 4|6|9|11:
print(30)
case 2:
if y%4==0 and y%100!=0 or y%400==0:
print(29)
else:
print(28)
case 1|3|5|7|8|10|12:
print(31)
#include <iostream>
using namespace std;
int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int y , m;
cin >> y >> m;
if(y % 400 == 0 || ( y %4 == 0 && y % 100 != 0 ) ){
days[2] = 29;
}
cout << days[m];
}
#include <iostream>
using namespace std;
int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int y , m;
cin >> y >> m;
if(y % 400 == 0 || ( y %4 == 0 && y % 100 != 0 ) ){
days[2] = 29;
}
cout << days[m];
}
#include <iostream>
using namespace std;
int days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
int main(){
int y , m;
cin >> y >> m;
if(y % 400 == 0 || ( y %4 == 0 && y % 100 != 0 ) ){
days[2] = 29;
}
cout << days[m];
}