var
b:array[1..12]of longint=(31,28,31,30,31,30,31,31,30,31,30,31);
m,j,k,n,t,i:longint;
a:array[0..6]of longint;
begin
readln(N);
k:=1;
for j:=1900 to 1900+n-1 do
begin
if (j mod 4=0)and(j mod 100<>0)or(j mod 400=0) then b[2]:=29 else b[2]:=28;
for t:=1 to 12 do
begin
inc(a[(m+13)mod 7]);
m:=m+b[t];
end;
end;
write(a[6],' ',a[0],' ');
for i:=1 to 5 do
write(a[i],' ');
end.