program newyear;
var x,y,b:integer;
begin
writeln('Vvedite den i nomer mesyaca');
readln(y,x);
if (x>12) or (x<1) or (y<1) or (y>31) then writeln('Nevernie dannie')
else
case x of
12: b:=365-(334+y)+1;
11: b:=365-(304+y)+1;
10: b:=365-(273+y)+1;
9: b:=365-(243+y)+1;
8: b:=365-(212+y)+1;
7: b:=365-(181+y)+1;
6: b:=365-(151+y)+1;
5: b:=365-(120+y)+1;
4: b:=365-(90+y)+1;
3: b:=365-(59+y)+1;
2: b:=365-(31+y)+1;
1: b:=365-y+1;
end;
writeln('Do novogo goda ostalos ',b,' dnej/den/dnya');
end.