#include <iostream> #include <cmath> using namespace std; typedef long long ll; int main() { int n,m; cin>>n>>m; int mounth[]={0,31,(n%4==0&&n%100!=0)||n%400==0?29:28,31,30,31,30,31,31,30,31,30,31}; cout<<mounth[m]; return 0; }