var a,b,c:integer; th:integer; begin read(a); read(th); case a of 1,3,5,7,8,11,12:c:=31 ; 4,6,9,10:c:=30 ; 2:c:=28; if th mod 4=0 then begin c:=29 else writeln('gak ada'); write(th); end; readln; readln; end.