var
n,c,d,e:longint;
a:array[0..6]of longint;
begin
assign(input,'friday.in');
assign(output,'friday.out');
reset(input);
rewrite(output);
readln(n);
e:=6;
inc(a[6]);
for c:=1900 to 1899+n do
for d:=1 to 12 do
if (c<>1900)or(d<>1)then
begin
if (d=2)or(d=4)or(d=6)or(d=8)or(d=9)or(d=11)or(d=1)then
begin
e:=(e+31)mod 7;
inc(a[e]);
end;
if (d=5)or(d=7)or(d=10)or(d=12)then
begin
e:=(e+30)mod 7;
inc(a[e]);
end;
if d=3 then
if ((c mod 4=0)and(c mod 100<>0))or(c mod 400=0)then
begin
e:=(e+29)mod 7;
inc(a[e]);
end
else
begin
e:=(e+28)mod 7;
inc(a[e]);
end;
end;
write(a[6],' ');
for c:=0 to 5 do write(a[c],' ');
writeln;
close(input);close(output);
end.