#include <bits/stdc++.h>
using namespace std;
const int menology[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int year, mouth;
int main() {
cin >> year >> mouth;
if (mouth == 2 and (year % 400 == 0 or year % 4 == 0))
cout << 29;
else
cout << menology[mouth];
return 0;
}
没分求解