semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int m[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
	int w;
	cin >> w;
	int days = 13;
	for (int i = 1; i <= 12; i++)
	{
		days += m[i - 1];
		if ((days - 1 + w) % 7 == 5)
			cout << i << endl;
	}
	return 0;
}
int main(){
	int w,sum=0,a;
	scanf("%d",&w);
	for(int i=0;i<12;i++){
		if(i==0){
			sum=0;
		}else if(i==1||i==3||i==5||i==7||i==8||i==10){
			sum+=31;
		}else if(i==4||i==6||i==9||i==11){
			sum+=30;
		}else if(i==2){
			sum+=28;
		}
		a=(sum+13-1+w-7)%7;
		if(a==5){
			printf("%d\n",i+1);
		}
	}
	return 0;
}
int main()
{
	int m,n,a,b,c;
	scanf("%d",&n);
	
	for(m=1;m<13;m++)
	{
	  a=5-n;
	  b=1+a;
	  c=(13-b)%7;
	  if(c==0)
	  {
		  printf("%d\n",m);
	  }
	  if(m==1||m==3||m==5||m==7||m==8||m==10)
	  {
		  n=n+3;
	  }
	  if(m==4||m==6||m==9||m==11)
	  {
		  n=n+2;
	  }
	  if(m==2)
	  {
		  n=n;
	  }
	}


	return 0;
}
void main()
{int h;scanf("%d",&h);if((h+12)%7==5)printf("1\n");if((h+43)%7==5)printf("2\n");if((h+71)%7==5)printf("3\n");if((h+102)%7==5)printf("4\n");if((h+132)%7==5)printf("5\n");if((h+163)%7==5)printf("6\n");if((h+193)%7==5)printf("7\n");if((h+224)%7==5)printf("8\n");
if((h+255)%7==5){printf("9\n");}
if((h+285)%7==5){printf("10\n");}
if((h+316)%7==5){printf("11\n");}
if((h+346)%7==5){printf("12\n");}
}
int main()
{
	int w;
	cin >> w;
	int mon[12] = {0,31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30};
	int i, r;
	int day;
	day = 12;
	for (i = 0; i < 12; i++)
	{
		day = day + mon[i];
		r = day % 7;
		if (r + w == 5)
			cout << i + 1 << endl;
		if ((r + w > 7) && (r + w - 7 == 5))
			cout << i + 1 << endl;
	}
	return 0;
}
int main()
{
	int i,a[12],b[12],w;
	cin>>w;
	a[0]=13;a[1]=a[0]+31;a[2]=a[1]+28;a[3]=a[2]+31;a[4]=a[3]+30;a[5]=a[4]+31;a[6]=a[5]+30;a[7]=a[6]+31;a[8]=a[7]+31;a[9]=a[8]+30;a[10]=a[9]+31;a[11]=a[10]+30;
	for(i=0;i<12;i++)
	{
	        b[i]=(a[i]+w-1)%7;
	}
	for(i=0;i<12;i++)
	{
		if(b[i]==5)
		cout<<i+1<<endl;
	}
	return 0;
}
int main()
{
	int days[13]={0,12,31,28,31,30,31,30,31,31,30,31,30};
	int result[13]={0};   //?result?????13?????
	int sum=0;      //?sum????????k???????
	int w;   //??????????
	cin>>w;
	for(int k=1;k!=13;k++)
	{
		sum+=days[k];
		result[k]=(sum+w)%7;
	}
	for(int k=1;k!=13;k++)
		if(result[k]==5)
			cout<<k<<endl;
	return 0;
}
int main()	
{
	int w,d[11],t,i;
	scanf("%d",&w);
	d[0]=w+12;
	t=0;
	for(i=1;i<=11;i++){
		if(i==1||i==3||i==5||i==7||i==8||i==10){
			d[i]=d[i-1]+31;
		}
		else if(i==2){
			d[i]=d[i-1]+28;
		}
		else {
			d[i]=d[i-1]+30;
		}
	}
	
	for(i=0;i<=11;i++){
		if(d[i]%7==5){
			if(t==0){
				t=1;
				printf("%d",i+1);
			}
			else{
				printf("\n%d",i+1);
			}
		}
	}
}
int main()
{   
   int n,a,B,C,D,E,F,G,H,I,J,K,L;
   scanf("%d",&n);
   a=(13+n-1)%7;
   if(a==5)
	   printf("1\n");
   B=(31+13+n-1)%7;	
   if(B==5)
	   printf("2\n");
   C=(31+28+13+n-1)%7;
   if(C==5)
	   printf("3\n");
   D=(31+28+31+13+n-1)%7;
   if(D==5)
	   printf("4\n");
   E=(31+28+31+30+13+n-1)%7;
   if(E==5)
	   printf("5\n");
   F=(31+28+31+30+31+13+n-1)%7;
   if(F==5)
	   printf("6\n");
   G=(31+28+31+30+31+30+13+n-1)%7;
   if(G==5)
	   printf("7\n");
   H=(31+28+31+30+31+30+31+13+n-1)%7;
   if(H==5)
	   printf("8\n");
   I=(31+28+31+30+31+30+31+31+13+n-1)%7;
   if(I==5)
	   printf("9\n");
   J=(31+28+31+30+31+30+31+31+30+13+n-1)%7;
   if(J==5)
	   printf("10\n");
   K=(31+28+31+30+31+30+31+31+30+31+13+n-1)%7;
   if(K==5)
	   printf("11\n");
   L=(31+28+31+30+31+30+31+31+30+31+30+13+n-1)%7;
   if(L==5)
	   printf("12\n");
   return 0;
}
void main()
{
	int n,w;
	scanf("%d",&w);
	if((12%7+w-7==5)||(12%7+w==5)) printf("1\n");
	if((43%7+w-7==5)||(43%7+w==5)) printf("2\n");
    if((71%7+w-7==5)||(71%7+w==5)) printf("3\n");
	if((102%7+w-7==5)||(102%7+w==5)) printf("4\n");
    if((132%7+w-7==5)||(132%7+w==5)) printf("5\n");
	if((163%7+w-7==5)||(163%7+w==5)) printf("6\n");
    if((193%7+w-7==5)||(193%7+w==5)) printf("7\n");
	if((224%7+w-7==5)||(224%7+w==5)) printf("8\n");
    if((255%7+w-7==5)||(255%7+w==5)) printf("9\n");
	if((285%7+w-7==5)||(285%7+w==5)) printf("10\n");
    if((316%7+w-7==5)||(316%7+w==5)) printf("11\n");
	if((346%7+w-7==5)||(346%7+w==5)) printf("12\n");
}
int main()
{
	int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int w,i,j,day=0,m,jan=0;
	int first=1;
	scanf("%d",&w);
	if(w<=5)
		m=6-w;
	else m=13-w;
	if((13-m)%7==0){
		printf("1");
		jan=1;
	}
	for(i=1;i<12;i++)
	{
		day+=14+month[i-1];
		if ((day-m-1)%7==0)
			if(first){
				if(jan){
					printf("\n%d",i+1);
					first=0;
				}else{
				printf("%d",i+1);
				first=0;
				}
			}else printf("\n%d",i+1);
	}
	return 0;
}
void main()
{
	int w,i,a[12];
	scanf("%d",&w);
	a[0]=w+5;
	a[1]=w+1;
	a[2]=w+1;
	a[3]=w+4;
	a[4]=w+6;
	a[5]=w+2;
	a[6]=w+4;
	a[7]=w;
	a[8]=w+3;
	a[9]=w+5;
	a[10]=w+1;
	a[11]=w+3;
	for(i=0;i<12;i++)
	    if(a[i]>7)a[i]=a[i]-7;
	for(i=0;i<12;i++)
		if(a[i]==5)
		printf("%d\n",i+1);
}
int main()
{
	int w, m, d;
	int sum = 0;
	cin >> w;
	int w0 = w;
	int a[14];
	a[1] = a[3] = a[5] = a[7] = a[8] = a[10] = a[12] = 31;
	a[4] = a[6] = a[9] = a[11] = 30;
	a[2] = 28;
	for(m = 1; m <= 12; m++)
	{
		for(int i = 1; i < m; i++)
			sum += a[i];
		sum += 12;
		d = sum % 7;
		w = w + d;
		if(w % 7 == 5)
			cout << m << endl;
		sum = 0;
		w = w0;
	}
	return 0;
}
int main(){
   int a,date,m[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
   scanf("%d",&a);
   //printf("%d",a);
   int i,b=a-1;
   for(i=1;i<=12;i++){
	   date=0;
	   while(date<m[i]){
		       date++;
		if(b<7) b++;
		else b=1;
		//printf("%d %d\n",date,b);
		if(date==13 && b==5){
			printf("%d\n",i);
		}
	  }
   }
   return 0;
}
int main()
{
	int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
	int w,i,i2,day,x;
	scanf("%d",&w);
	for(i=1;i<=12;i++){
		day=0;
		for(i2=0;i2<i;i2++){
			day=day+a[i2];
		}
		x=(day+12+w)%7;
		if(x==5)
			printf("%d\n",i);
	}
}
int main()
{
	int w, i, s, t, n;
	scanf("%d", &w);
	for(i=0;i<12;i++){
		if(i==0){
			s=13;
		}
		else if(i==1||i==3||i==5||i==7||i==8||i==10){
			s+=31;
		}
		else if(i==2){
			s+=28;
		}
		else if(i==4||i==6||i==9||i==11){
			s+=30;
		}
		t=s-6+w;
		if(t%7==0){
			n=i+1;
			printf("%d\n", n);
		}
	}
	return 0;
}
int main()
{
    int w,i,a[15],sum=0;
    scanf("%d",&w);
    for(i=1;i<13;i++){
        if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
          a[i]=31;
         else if(i==4||i==6||i==9||i==11) 
          a[i]=30;
          else 
           a[i]=28;
        if(i==1)
          sum+=13;
         else
         sum+=a[i-1]; 
         if((sum+w-1)%7==5)
            printf("%d\n",i);                
    }
}
void main()
{
	int w,i;
	int a[13];
	scanf("%d",&w);
	a[1]=w+12%7;
	if(a[1]>7)
		a[1]=a[1]-7;
	for(i=2;i<=12;i++)
	{
		if(i==2||i==4||i==6||i==8||i==9||i==11)
		{
			a[i]=a[i-1]+31%7;
		}
		if(i==3)
		{
			a[i]=a[i-1]+28%7;
		}
		if(i==5||i==7||i==10||i==12)
		{
			a[i]=a[i-1]+30%7;
		}
		if(a[i]>7)
		a[i]=a[i]-7;
	}
	for(i=1;i<=12;i++)
	{
		if(a[i]==5)
			printf("%d\n",i);
	}
}
int main ()
{
	int w,i,flag=0,j=0,a=0;
	int b[12]={0,31,28,31,30,31,30,31,31,30,31,30};
	int c[12];
	scanf("%d",&w);
	if((w>7)||(w<1))
		printf("Error!");
	else
	{ for(i=0;i<12;i++)
	{a=a+b[i];
	   if((w+12+a)%7==5)
	     {flag++;
	      c[j]=i;
		  j++;}}
	  for(i=0;i<j;i++)
		  printf("\n%d",c[i]+1);
	}
	return 0;
}
int main(){
int w,sz[12],m,i;
scanf("%d\n",&w);
sz[1]=w+12;
sz[2]=w+12+31;
sz[3]=w+12+31+28;
sz[4]=w+12+31+28+31;
sz[5]=w+12+31+28+31+30;
sz[6]=w+12+31+28+31+30+31;
sz[7]=w+12+31+28+31+30+31+30;
sz[8]=w+12+31+28+31+30+31+30+31;
sz[9]=w+12+31+28+31+30+31+30+31+31;
sz[10]=w+12+31+28+31+30+31+30+31+31+30;
sz[11]=w+12+31+28+31+30+31+30+31+31+30+31;
sz[12]=w+12+31+28+31+30+31+30+31+31+30+31+30;
for(i=1;i<=12;i++){
m=sz[i]%7;
if(m==5){
printf("%d\n",i);
}
}
return 0;
}
int main()

{
  int w,p;
  cin >> w;
  int a[12]={13,13+31,13+31+28,13+31+28+31,13+31+28+31+30,13+31+28+31+30+31,
  13+31+28+30+31+30+31,13+31+28+30+31+30+31+31,13+31+28+30+31+30+31+31+31,
  13+31+28+30+31+30+31+31+30+31,13+31+28+30+31+30+31+31+30+31+31,
  13+31+28+30+31+30+31+31+30+31+31+30};
  if (w<=5)
    p=6-w;
  else
    p=13-w;
  for (int i=0;i<12;i++)
  {
  	if ((a[i]-p)%7==0)
  	 cout << i+1 << endl;
  }
  return 0;
}
int main()
{
	int xingqi,yue,zong=0,panduan;
	scanf("%d",&xingqi);
	for(yue=1;yue<13;yue++){
		panduan=(zong+12)%7+xingqi;
		if(panduan>7)
			panduan=panduan-7;
		if(panduan==5)
			printf("%d\n",yue);
		if(yue==1||yue==3||yue==5||yue==7||yue==8||yue==10||yue==12)
			zong=zong+31;
		else if(yue==4||yue==6||yue==9||yue==11)
			zong=zong+30;
		else if(yue==2)
			zong=zong+28;
	}
	return 0;
}
int main(){
  int w,i,a;
  scanf("%d",&w);
  for(i=1;i<13;i++){
    a=w+5;
    if(a>7){a=a-7;}
    if(a==5){printf("%d\n",i);}
    if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
      w=w+3;if(w>7){w=w-7;}
    }
    if(i==4||i==6||i==9||i==11){
      w=w+2;if(w>7){w=w-7;}
    }
    if(i==2){w=w;}
  }
return 0;
}
int main()
{
int w;
cin>>w;
int i=0;
int a[13],day[13]={12,31,28,31,30,31,30,31,31,30,31,30,31};
a[0]=w;
for(i=1;i<=12;i++)
{
a[i]=(a[i-1]+(day[i-1]%7))%7;
if(a[i]==5)cout<<i<<endl;
}
return 0;
}
int main()
{
    int a[12]={31,28,31,30,31,30,31,31,30,31,30,31},b[12],i,w;
    scanf("%d",&w);
    w=w+12;
    for(i=0;i<12;i++)
        b[i]=a[i]%7;
    if(w%7==5) printf("1\n");
    for(i=0;i<11;i++)
    {
        w=w+a[i];
        if(w%7==5) printf("%d\n",i+2);
    }
    return 0;
}
int main(int argc, char* argv[])
{
	int w;
	scanf("%d",&w);
	int m[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int i,j;
	for(i=0;i<12;i++){
		int d=0;
		for(j=0;j<i;j++){
			d=d+m[j];
		}
		d=d+13;
		switch(w%7){
		case 0:d=d-1;break;
		case 1:d=d-0;break;
		case 2:d=d-6;break;
		case 3:d=d-5;break;
		case 4:d=d-4;break;
		case 5:d=d-3;break;
		case 6:d=d-2;break;
		}
		if(d%7==5){
			printf("%d\n",i+1);
		}
	}
	return 0;
}
int main()
{
    int w,i;
    scanf("%d", &w);
    int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    int b[13];
    b[1]=w;
    for(i=2;i<=12;i++)
    {
                      if(a[i-1]==31)
                      b[i]=(b[i-1]+3)%7;
                      else if(a[i-1]==30)
                      b[i]=(b[i-1]+2)%7;
                      else if(a[i-1]==28)
                      b[i]=b[i-1];
    }
    for(i=1;i<=12;i++)
    {
                      if(b[i]==0||b[i]==7)
                      {
                      printf("%d", i);
                      printf("\n");
                      }
    }                      

    return 0;
}
int main()
{
 int  w,t,m,i;
 m=0;
 t=0;
 scanf("%d",&w);
 if(w>=1&&w<=7)
  m=6-w;
 else if(w>=6&&w<=7)
  m=13-w;
 int a[15]={0,31,59,90,120,151,181,212,243,273,304,334};
    for(i=0;i<=11;i++)
  if((a[i]+13-m)%7==0)
  {t=i+1;
  printf("%d\n",t);}
return 0;
}
int main(){
    int m[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    int i,w,a,b,c,d;
    scanf("%d",&w);
    a=w+12;
    if(a%7==5)
    {
        printf("1\n") ;   
    }
    for(i=0;i<11;i++)
    {
        a=w+m[i]+12;
        if(a%7==5)
      {
            d=i+2;
        printf("%d\n",d) ;   
      }
      b=m[i+1] ;
      c=m[i]; 
      m[i+1]=b+c;
    }
    return 0;
        
}
void main()
{
   int w,i;
   struct time
     {int month;
      int xingq;
      int n;
      };
    struct time a[12];
   for(i=0;i<12;i++)
     a[i].month=i+1;
     a[0].n=13;a[1].n=44;a[2].n=72;a[3].n=103;a[4].n=133;a[5].n=164;a[6].n=194;
     a[7].n=225;a[8].n=256;a[9].n=286;a[10].n=317;a[11].n=347;
  scanf("%d",&w);
  for(i=0;i<12;i++)
  {a[i].xingq=a[i].n%7;
  if(a[i].xingq==0)
	  a[i].xingq=7;
  a[i].xingq=(a[i].xingq+w-1)%7;}
  for(i=0;i<12;i++)
  {if(a[i].xingq==5)
  printf("%d\n",a[i].month);}
}
int main(int argc, char* argv[])
{
	int month[13];
	int day,n=0,i,d;
	scanf("%d",&day);
	for(i=1;i<=12;i++)
	{   month[0]=0;
		if(i==2)
		{  
			month[i]=28;
		}

		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{
		   month[i]=31;
		}
		if(i==4||i==6||i==9||i==11)
		{
			month[i]=30;
		}
	    n+=month[i-1];	
		d=((((n+13)%7)+day)%7)-1;
		if(d==5)
		{
			printf("%d\n",i);
		}
	}
	
	
	return 0;
}
int main(int argc, char* argv[])
{
	int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int w,i;
	scanf("%d",&w);
	w=(w+12)%7;
	if(w==5){
		printf("1\n");
	}
	for(i=0;i<11;i++){
		w=(w+day[i])%7;
		if(w==5){
			printf("%d\n",i+2);
		}
	}
	return 0;
}
void main()
{
	int w,z[12]={0,31,28,31,30,31,30,31,31,30,31,30},i,k,j,l;
	int function(int,int);
	int o[12]={0};
	scanf("%d",&w);
	for(i=0;i<12;i++)
	{
            for(j=0;j<=i;j++)
		{
			o[i]=o[i]+z[j];
		}
	}
	for(i=0;i<12;i++)
	{
		k=function(w,o[i]);
		if(k!=0)
		{
                            l=i+1;
			printf("%d\n",l);
		}
		else continue;
	}
}

int function(int x,int y)
{
	int z=0,u;
	u=(x+y+13-1)%7;
	if(u==5)
	{
		z=1;
	}
	return(z);
}
main()
{
   int days[]={0,31,28,31,30,31,30,31,31,30,31,30,31},m,w,d=13,i,b;
   
  
   scanf("%d",&w);
    b=w;
   for(m=1;m<13;m++)
     {
     	w=b;
     {for(i=1;i<m;i++)
       {w+=days[i];} w+=12;}
	   if(w%7==5) printf("%d\n",m);}
}
void bad(int w)
{int i,j,W;
W=w;
for(i=1;i<13;i++)
{switch(i)
{
	case 1:
	case 3:
	case 5:
	case 7:
	case 8:
	case 10:
	case 12:
		{for(j=1;j<32;j++)
		{if(W==5&&j==13)
				printf("%d\n",i);
		if(W>6)
				W=1;
		else
				W++;}
		break;
		}
	case 4:
	case 6:
	case 9:
	case 11:
		{for(j=1;j<31;j++)
		{if(W==5&&j==13)
				printf("%d\n",i);
		if(W>6)
				W=1;
		else
				W++;}
		break;
		}
	case 2:
		{for(j=1;j<29;j++)
		{if(W==5&&j==13)
				printf("%d\n",i);
		if(W>6)
				W=1;
		else
				W++;}
		break;
		}
}}}


void main()
{
	int w;
	scanf("%d",&w);
	bad(w);
}
int main()
{
	int dayofweek,days=12,mon[12],i,d,e;
	scanf("%d",&dayofweek);
	for(i=0;i<12;i++)
	{
		if(i==1)
			mon[i]=28;
		else if(i==3||i==5||i==8||i==10)
			mon[i]=30;
		else
			mon[i]=31;

	}
	e=5-dayofweek;
	if(e<0)
		e+=7;
	for(i=0;i<12;i++)
	{
		d=days%7;
		if(d==e)
			printf("%d\n",i+1);
		days+=mon[i];	
	}
	return 0;
}
int main()
{
int w,a,b,s,d,f,g,h,j,k,l,r,i;
scanf("%d",&w);
i=13+w-1;	
a=44+w-1;
b=72+w-1;
s=103+w-1;
g=194+w-1;
h=225+w-1;
j=256+w-1;
k=286+w-1;
l=317+w-1;
r=347+w-1;
d=133+w-1;
f=164+w-1;
	if(i%7==5)
		{
			printf("1\n");
		}
    if(a%7==5)
		{
			printf("2\n");
		}
	if(b%7==5)
		{
			printf("3\n");
		}
    if(s%7==5)
		{
			printf("4\n");
		}
	if(d%7==5)
		{
			printf("5\n");
		}
	if(f%7==5)
		{
			printf("6\n");
		}
	if(g%7==5)
		{
			printf("7\n");
		}
	if(h%7==5)
		{
			printf("8\n");
		}
	if(j%7==5)
		{
			printf("9\n");
	}
	if(k%7==5)
		{
			printf("10\n");
		}
	if(l%7==5)
		{
			printf("11\n");
		}
	if(r%7==5)
		{
			printf("12");
		}
	return 0;
}
void main()
{
int q;
scanf("%d",&q);
if(q==7)
{printf("1\n");
printf("10");}
if(q==2)
{printf("9\n");
printf("12");}
if(q==4)
{printf("2\n");
printf("3\n");
printf("11\n");}
if(q==5)printf("8\n");
if(q==3)printf("6\n");
if(q==1)
{printf("4\n");
printf("7");}
if(q==6)printf("5");
}
int main(){
	int days=0,firstday;//days???????????firstday???????
	cin>>firstday;
	int month[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	for(int i=0;i<12;i++){
		for(int j=0;j<i;j++) days=days+month[j];//?????????????
		days=days+12+firstday;//????13???????????
		if(days%7==5) cout<<i+1<<endl;
		days=0;
	}
}
int main()
{
    int n,month[12]={13,44,72,103,133,164,194,225,256,286,317,347},i,s[12];
	scanf("%d",&n);
	for(i=0;i<12;i++)
	{
		s[i]=month[i]%7;
		if(n<=5)
		{
			if(s[i]==6-n)
			{
				printf("%d\n",i+1);
			}
		}
		else if(n==6)
		{
			if(s[i]==0)
			{
				printf("%d\n",i+1);
			}
		}
		else 
		{
			if(s[i]==6)
			{
				printf("%d\n",i+1);
			}
		}
	}

	return 0;
}
int main()
{
	int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int w,i,j,m,b[11];
	scanf("%d",&w);
	for(i=0; i<12; i++)
	{
	    m=12;
		for(j=0; j<i; j++)
		{
			m+=a[j];
		}
		b[i]=(m%7+w)%7;
		if(b[i]==5)
			printf("%d\n",i+1);

	}
	return 0;
}
main()
{
	int w;
	scanf("%d",&w);
	w=w+7;
	if(w%7==0)
	{
		printf("1\n");
	}
	w=w+31;
	if(w%7==0)
	{
		printf("2\n");
	}
	w=w+28;
	if(w%7==0)
	{
		printf("3\n");
	}
	w=w+31;
	if(w%7==0)
	{
		printf("4\n");
	}
	w=w+30;
	if(w%7==0)
	{
		printf("5\n");
	}
	w=w+31;
	if(w%7==0)
	{
		printf("6\n");
	}
	w=w+30;
	if(w%7==0)
	{
		printf("7\n");
	}
	w=w+31;
	if(w%7==0)
	{
		printf("8\n");
	}	
	w=w+31;
	if(w%7==0)
	{
		printf("9\n");
	}
	w=w+30;
	if(w%7==0)
	{
		printf("10\n");
	}	
	w=w+31;
	if(w%7==0)
	{
		printf("11\n");
	}
	w=w+30;
	if(w%7==0)
	{
		printf("12\n");
	}
}
int main()
{
	int n;
	scanf("%d", &n);
	n+=12;
	if(n%7==5) printf("1\n");
	n+=31;
	if(n%7==5) printf("2\n");
	n+=28;
	if(n%7==5) printf("3\n");
	n+=31;
	if(n%7==5) printf("4\n");
	n+=30;
	if(n%7==5) printf("5\n");
	n+=31;
	if(n%7==5) printf("6\n");
	n+=30;
	if(n%7==5) printf("7\n");
	n+=31;
	if(n%7==5) printf("8\n");
	n+=31;
	if(n%7==5) printf("9\n");
	n+=30;
	if(n%7==5) printf("10\n");
	n+=31;
	if(n%7==5) printf("11\n");
	n+=30;
	if(n%7==5) printf("12\n");
}
int main(int argc, char* argv[])
{
	int a,i,n;
	int b[12]={13,44,72,103,133,164,194,225,256,286,317,347};
	scanf("%d",&n);
	if(n==5)a=1;
	if(n==6)a=0;
	if(n==7)a=6;
	else a=6-n;
	for(i=0;i<12;i++){
	    if(b[i]%7==a)printf("%d\n",i+1);
	}
	return 0;
}
void main()
{
	int mon,day,i,sumday,a,b;//
	scanf("%d",&day);
	for(mon=1;mon<=12;mon++)
	{
		switch(mon)
		{
			case 1:sumday=12;break;
			case 2:sumday=31+12;break;
			case 3:sumday=59+12;break;
			case 4:sumday=90+12;break;
			case 5:sumday=120+12;break;
			case 6:sumday=151+12;break;
			case 7:sumday=181+12;break;
			case 8:sumday=212+12;break;
			case 9:sumday=243+12;break;
			case 10:sumday=273+12;break;
			case 11:sumday=304+12;break;
			case 12:sumday=334+12;break;
		}

		a=sumday%7;
		b=day+a;
		if(b>7){b=b-7;}

		if(b==5)printf("%d\n",mon);
	}
}
int main()
{
	int n,i;
    scanf("%d",&n);
 int a[12],b[12];
a[0]=12%7;
a[1]=43%7;
a[2]=71%7;
a[3]=102%7;
a[4]=132%7;
a[5]=163%7;
a[6]=193%7;
a[7]=224%7;
a[8]=255%7;
a[9]=285%7;
a[10]=316%7;
a[11]=346%7;
for(i=0;i<12;i++)
{if((a[i]+n)>7)
{
	b[i]=a[i]+n-7;
}
else
{b[i]=a[i]+n;}
}
for(i=0;i<12;i++)
{if(b[i]==5)

{printf("%d\n",i+1);}
}
		
		
 
   return 0;
}
int main() 
{ 
int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31},fw,i,j; 
scanf("%d", &fw); 
for (i=0;i<12;i++) 
{ 
for(j = 0;j < monthday[i]; j++) 
{ 
if (fw == 5 && j == 12) printf("%d\n", (i+1)); 
fw = (fw == 7) ? 1 : (fw+1); 
} 
} 
return 0; 
}
int main()
{
	int w,w1,w2,w3,w4,w5,w6,w7,w8,w9,w10,w11,w12;
	scanf("%d",&w);
	w1=w+5;
	if(w1>7)
	{
		w1=w1-7;
	}
	if(w1==5)
	{
		printf("1\n");
	}
	w2=w1+3;
	if(w2>7)
	{
		w2=w2-7;
	}
	if(w2==5)
	{
		printf("2\n");
	}
    w3=w2;
	if(w3==5)
	{
		printf("3\n");
	}
	w4=w3+3;
	if(w4>7)
	{
		w4=w4-7;
	}
	if(w4==5)
	{
		printf("4\n");
	}
	w5=w4+2;
	if(w5>7)
	{
		w5=w5-7;
	}
	if(w5==5)
	{
		printf("5\n");
	}
	w6=w5+3;
	if(w6>7)
	{
		w6=w6-7;
	}
	if(w6==5)
	{
		printf("6\n");
	}
	w7=w6+2;
	if(w7>7)
	{
		w7=w7-7;
	}
	if(w7==5)
	{
		printf("7\n");
	}
	w8=w7+3;
	if(w8>7)
	{
		w8=w8-7;
	}
	if(w8==5)
	{
		printf("8\n");
	}
	w9=w8+3;
	if(w9>7)
	{
		w9=w9-7;
	}
	if(w9==5)
	{
		printf("9\n");
	}
	w10=w9+2;
	if(w10>7)
	{
		w10=w10-7;
	}
	if(w10==5)
	{
		printf("10\n");
	}
	w11=w10+3;
	if(w11>7)
	{
		w11=w11-7;
	}
	if(w11==5)
	{
		printf("11\n");
	}
	w12=w11+2;
	if(w12>7)
	{
		w12=w12-7;
	}
	if(w12==5)
	{
		printf("12\n");
	}

	return 0;
}
int main()
{
    int w,i,a;
    int sz[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
    scanf("%d",&w);
    w+=12;
    if((w%7)==5){
       printf("1\n");
    }
    for(i=1;i<12;i++){
        w+=sz[i];
        if((w%7)==5){
           a=i+1;
           printf("%d\n",a);
        }
    }
    return 0;
}
int main()
{
	int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31},m,i,j,day=0;
	cin>>m;                                 //???????m?
	for(i=1;i<=12;i++)
	{
		day=0;
                j=1;
		while(j<=i-1)
		{
            day+=month[j];
			j++;
		}
		day+=13;
        if((day+m-6)%7==0) cout<<i<<endl;
	}
 return 0;
}
int main()
{
	int n,m;
		int sz[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	scanf("%d",&n);

	for(int i=0;i<12;i++)
	{m=0;
		for(int j=0;j<i;j++)
		{
			m+=sz[j];
		}
		if((m+n+12)%7==5)
			printf("%d\n",i+1);
	}
	return 0;
}
int main()
{
    int w,i;
    int m[12]={13,44,72,103,133,164,194,225,256,286,317,347};
    
    scanf("%d",&w);
    for (i=0; i<12; i++) {
        if (w==1) {
            if ((m[i]-5)%7==0) {
                printf("%d\n",i+1);
            }

        }
        else
        if ((m[i]-5)%7==(8-w)) {
            printf("%d\n",i+1);
        }
    }
    
}
int main(int argc, char* argv[])
{
   int n,day,yu,i,k;
   int sum=0;
   int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
    scanf("%d",&n);
	for(i=0;i<12;i++){
		sum=0;
		for(k=0;k<i;k++){
			sum=sum+monthday[k];
		}
		sum=sum+12;
		yu=sum%7;
		if(yu+n<=7){
			day=yu+n;
		}
		else if(yu+n>7){
			day=n-(7-yu);
		}
		else;
		if(day==5){
			printf("%d\n",i+1);
		}
	}

	   

	return 0;
}
int main()
{
	int initialday,month;
	scanf("%d",&initialday);
	for(month=1;month<=12;month++)
	{
		switch(month)
		{
			case 1:
				if((initialday+7)%7==0)
					printf("1\n");
				break;
			case 2:
				if((initialday+38)%7==0)
					printf("2\n");
				break;
			case 3:
				if((initialday+66)%7==0)
					printf("3\n");
				break;
			case 4:
				if((initialday+97)%7==0)
					printf("4\n");
				break;
			case 5:
				if((initialday+127)%7==0)
					printf("5\n");
				break;
			case 6:
				if((initialday+158)%7==0)
					printf("6\n");
				break;
			case 7:
				if((initialday+188)%7==0)
					printf("7\n");
				break;
			case 8:
				if((initialday+219)%7==0)
					printf("8\n");
				break;
			case 9:
				if((initialday+250)%7==0)
					printf("9\n");
				break;
			case 10:
				if((initialday+280)%7==0)
					printf("10\n");
				break;
			case 11:
				if((initialday+311)%7==0)
					printf("11\n");
				break;
			case 12:
				if((initialday+341)%7==0)
					printf("12\n");
				break;
		}
	}
	
	return 0;
}
int w;
void judge(int month,int w);
void main()
{
	int month,cha;
	scanf("%d",&w);
	month=1;
	cha=13;
	judge(month,cha);
	month=2;
	cha=13+31;
    judge(month,cha); 
	month=3;
	cha=13+31+28;
    judge(month,cha);
	month=4;
	cha=13+31+28+31;
    judge(month,cha);
	month=5;
	cha=13+31+28+31+30;
    judge(month,cha);
	month=6;
	cha=13+31+28+31+30+31;
    judge(month,cha);
	month=7;
	cha=13+31+28+31+30+31+30;
    judge(month,cha);
	month=8;
	cha=13+31+28+31+30+31+30+31;
    judge(month,cha);
	month=9;
	cha=13+31+28+31+30+31+30+31+31;
    judge(month,cha);
	month=10;
	cha=13+31+28+31+30+31+30+31+31+30;
    judge(month,cha);
	month=11;
	cha=13+31+28+31+30+31+30+31+31+30+31;
    judge(month,cha);
	month=12;
	cha=13+31+28+31+30+31+30+31+31+30+31+30;
    judge(month,cha);
}
void judge(int month,int cha)
{
	int x;
	x=(w+cha-1)%7;
	if(x==5) printf("%d\n",month);
}
main()
{
      int w;
      scanf("%d",&w);
      int m[13];
      m[0]=0;
      m[1]=31;
      m[2]=28;
      m[3]=31;
      m[4]=30;
      m[5]=31;
      m[6]=30;
      m[7]=31;
      m[8]=31;
      m[9]=30;
      m[10]=31;
      m[11]=30;
      m[12]=31;
      int s=0;int p=1;
      
      for(int j=1;j<13;j++)
         {    int s=0;
              for(int x=0;x<j;x++)
              {
                      s=s+m[x];
              }
              s=s+13;
              
              if(((s-1)%7+w%7)%7==5)
              { 
                printf("%d\n",j);
                
              }
              
         }
         
         
         
}
int ifunlucky(int d);
int main()
{
    int w,t;
    scanf("%d",&w);
    int m=1;
    for(m=1;m<=12;m++){
    t=ifunlucky(m);
    if((t+w-5)%7==0){
    printf("%d\n",m);
    }
    }
    return 0;
}
int ifunlucky(int d){
int k=0;
int i=1;
for(i=1;i<d;i++){
if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
k+=31;
}else if(i==2){
k+=28;
}else{
k+=30;
}
}
return k+12;
}