var a,b,c,d,e,f:integer;
begin
repeat
readln(a,b,c);
if a mod 4<>0 then d:=0
else if (a mod 100<>0) or (a mod 400=0) then d:=1
else d:=0;
case b of
1:e:=0;
2:e:=31;
3:e:=59;
4:e:=90;
5:e:=120;
6:e:=151;
7:e:=181;
8:e:=212;
9:e:=243;
10:e:=273;
11:e:=304;
12:e:=334;
end;
if b<=2 then f:=e+c;
if (b>2) and (b<=12) then f:=e+d+c;
if a<0 then writeln('Error')
else if b<=0 then writeln('Error')
else if (d=0) and (b=2) and (c>28) then writeln('Error')
else if (b=2) or (b=4) or (b=6) or (b=9) or (b=11) and (c>30)
then writeln('Error')
else if (c>31) then writeln('Error')
else if c<=0 then writeln('Error')
else if c=1 then writeln('It is 1 day in ',a)
else writeln('It is ',f,' days in ',a);
until eof;
end.