#include <stdio.h>
#include <stdlib.h>
int mon[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int day[7]={0};
int main(void)
{
int n,i,j,now=6;
FILE *fin,*fout;
fin=fopen("friday.in","r");
fout=fopen("friday.out","w");
fscanf(fin,"%d",&n);
n+=1900;
for(i=1900;i<n;i++){
if(i%400==0||(i%4==0&&i%100!=0)) mon[2]++;
for(j=1;j<=12;j++){
day[now]++;
now=now+mon[j];
now%=7;
}
mon[2]=28;
}
fprintf(fout,"%d",day[6]);
for(i=0;i<=5;i++){
fprintf(fout," %d",day[i]);
}
printf("\n");
fclose(fin);fclose(fout);
return 0;
}