semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	char num[105];
	int len;
	int answer[105]={0};
	int r=0;
	
	cin.getline(num,105);
	len=strlen(num);

	int i;

	for (i=0;i<len;i++)
	{
		r=r*10+num[i]-'0';
		answer[i]=r/13;
		r=r%13;
	}

	i=0;
	while(answer[i]==0)
		i++;
	for (;i<len;i++)
		cout<<answer[i];
	
	if (i>len+1)
		cout<<'0';

	cout<<endl<<r;

	return 0;
}
main()
{
      char a[100]={0},q[100]={0};
      int r;
      int b[100];
      int i,j,k,l=0;
      

                     for(k=0;k<100;k++)
                     {
                     b[k]=0;
                     a[k]=0;
                     q[k]=0;
                     }

                     scanf("%s",a); 
                     for(j=0;;j++)
                     if (a[j]=='\0') break;
                     l=j;
                     
                     b[0]=a[0]-'0';
                     for(j=0;j<l;j++)
                     {
                                          for (k=0;;k++)
                                          {
                                          if ((13*k)<=b[j] && (13*k+13)>b[j])
                                              {
                                                             q[j]=k+'0';
                                                             b[j]=b[j]-13*k;
                                                             goto label;
                                              }
                                          }
                                          label:
                                          b[j+1]=10*b[j]+a[j+1]-'0';
                     }
                     r=b[j-1];
                     
                     if (q[0]=='0' && q[1]=='\0') printf("0\n");
                     if (q[0]=='0' && q[1]=='0' && q[2]=='\0') printf("0\n");
                     if (q[0]=='0' && q[1]=='0' && q[2]!='\0') 
                     {
                                   j=2;
                                   while(q[j]!='\0') 
                                   {
                                                     printf("%c",q[j]);
                                                     j++;
                                   }
                                   printf("\n");
                     }
                     if (q[0]=='0' && q[1]!='0' && q[1]!='\0') 
                     {
                                   j=1;
                                   while(q[j]!='\0') 
                                   {
                                                     printf("%c",q[j]);
                                                     j++;
                                   }
                                   printf("\n");
                     }
                     if(q[0]!='0')
                     {
                                   j=0;
                                   while(q[j]!='\0')
                                    {
                                                     printf("%c",q[j]);
                                                     j++;
                                   }
                                   printf("\n");
                     }
                     
                     printf("%d\n",r);                     
      
}
int main()
{
	char num[101], result[100]; 
	int r = 0, i, len, j, temp; 
	cin.getline(num,100);
	len = strlen(num);
	for (i = 0; i < len; i++)
	{
		temp = (int)num[i] - 48;
		result[i] = ((r * 10 + temp) / 13) + 48;
		r = (r * 10 + temp) % 13;
	}
	for (j = 0; j < len; j++)
	{
		if (result[j] != '0')
			break;
	}
	if (j == len)
	{
		cout << 0 <<endl;
		cout << r ;
	}
	else 
	{
		for (j; j < len; j++)
		    cout << result[j];
	    cout <<endl;
	    cout <<r;
	}
	return 0;
}
//
//  main.cpp
//  ??13 ?2?
//
//  Created by ?? on 12-11-12.
//  Copyright (c) 2012? ??. All rights reserved.
//

int main()
{
    char n[100];
    int num[100], q[99], i, l, l2 = 0, r = 0;
    cin.getline(n, 100);
    l = strlen(n);
    for (i = 0; i < l; i++)
        num[i] = n[i] - '0';
    if (l == 2)
    {
        r = (num[0] * 10 + num[1]) % 13;
        q[0] = (num[0] * 10 + num[1]) / 13;
        l2++;
    }
    else if(l == 1)
    {
        q[0] = 0;
        r = num[0];
        l2++;
    }
    else if ((num[0] * 10 + num[1]) < 13)
    {
        q[0] = (num[0] * 100 + num[1] * 10 + num[2]) / 13;
        r = (num[0] * 100 + num[1] * 10 + num[2]) % 13;
        l2++;
        for (i = 2; i < l - 1; i++)
        {
            q[i - 1] = (r * 10 + num[i + 1]) / 13;
            r = r * 10 + num[i + 1] - q[i - 1] * 13;
            l2++;
        }
    }
    else
    {
        q[0] = (num[0] * 10 + num[1]) / 13;
        r = num[0] * 10 + num[1] - q[0] * 13;
        l2++;
        for (i = 1; i < l - 1; i++)
        {
            q[i] = (r * 10 + num[i + 1]) / 13;
            r = r * 10 + num[i + 1] - q[i] * 13;
            l2++;
        }
    }
    for (i = 0; i < l2; i++)
        cout << q[i];
    cout << endl;
    cout << r << endl;
    return 0;
}
int main()
{
	char num[100];
	int a, b, len;
	cin >> num;                //????
	len = strlen(num);
	if (len == 1)
		cout << '0' << '\n' << num[0];
	else
	{
		a = ((num[0] - '0') * 10 + (num[1] - '0')) / 13;
		b = ((num[0] - '0') * 10 + (num[1] - '0')) % 13;
		if (a != 0 || len == 2)
			cout << a;
		for (int i = 2; num[i] != '\0'; i++)
		{
			a = (b * 10 + (num[i] - '0')) / 13;
			b = (b * 10 + (num[i] - '0')) % 13;
			cout << a;
		}
		cout << '\n' << b << endl;
	}
	return 0;
}
char c[200];//??????
int n[200];//??????
int main()
{
	int number,len,i;
	while(cin>>c)
	{
		len=strlen(c);
		for(i=1;i<=len;i++) n[i]=c[i-1]-'0';
		if(len==1) {cout<<"0"<<endl<<n[1]<<endl;continue;}
		if(len==2) 
		{
			number=10*n[1]+n[2];
			cout<<number/13<<endl<<number%13<<endl;
			continue;
		}
		number=n[1]*10+n[2];
		i=2;
		if(number<13) number=10*number+n[++i];//???????????13
		cout<<number/13;
		while(i<len)
		{
			number=(number%13)*10+n[++i];
			cout<<number/13;
		}
		cout<<endl<<number%13<<endl;
	}
	return 0;
}
int main()
{
	int i,j=0,t,shang,yu,temp=0;
	char mult1[len];	
	scanf("%s",mult1);
	int len1 = strlen(mult1);
	int *c1 = (int *)malloc(sizeof(int)*len1);
	for(i=0; i<len1; i++)
	c1[i]=(int)mult1[i]-48;
	int *result = (int *)malloc(sizeof(int)*(len1));
	if((len1==2&&c1[len1-2]==1&&c1[len1-1]<3)||len1==1)
	{
		printf("0\n");
		if(len1==2)
		printf("%d",c1[len1-1]+c1[len1-2]*10);
		else
		printf("%d",c1[len1-1]);	
	}
	else
	{
		for(i=0;i<len1-1;i++)
		{
			t=(c1[i]*10+c1[i+1]);
			shang=t/13;
			result[j]=shang;
			j++;
			yu=t%13;
			c1[i+1]=yu;	
			
		}
		if(result[0]!=0)
		{
			for(i=0;i<len1-1;i++) 
			printf("%d",result[i]);
		}
		else
		{
			for(i=1;i<len1-1;i++) 
			printf("%d",result[i]);	
		}
		printf("\n");
		printf("%d",yu);
	} 
	free(c1);
	free(result);
	return 0;
}
main()
{
      char a[100],c[100];
      gets(a);
      int i,b,d,e;
      if (a[1]=='\0')
            {
                 printf("0\n");
                 printf("%c",a[0]);
            }
      else if (a[2]=='\0'&&a[0]-'0'==1)
      {

            if (a[1]-'0'<3)
            {
                printf("0\n");
                printf("%c",a[0]);
                printf("%c",a[1]);
            }
            else
            {
                printf("1\n");
                printf("%d",a[1]-'0'-3);
            }
      }
       else
       {
            i=0;
            b=a[i]-'0';
            while (a[i]!='\0')
          {
         d=b/13;
         e=b%13;
         b=e*10+(a[i+1]-'0');
         c[i]=d+'0';


         i++;
          }
       if (c[0]=='0'&&c[1]!='0')
       {
           i=1;
           while (c[i]>='0'&&c[i]<='9')
           {
               printf("%c",c[i]);
               i++;
           }
       }
       else if (c[0]=='0'&&c[1]=='0')
       {
           i=2;
           while (c[i]>='0'&&c[i]<='9')
           {
               printf("%c",c[i]);
               i++;
           }
       }
       else
       {
           i=0;
           while (c[i]>='0'&&c[i]<='9')
           {
               printf("%c",c[i]);
               i++;
           }
       }
      printf("\n%d",e);
      }
     getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}
int main()
{
char a[100];
int b[99],d[99];
int m,i,n=0;
scanf("%s",a);
m=strlen(a);
if(m==1)
{printf("0\n%d",(a[0]-'0'));}
else 
if(m==2)
{printf("%d\n%d",(10*(a[0]-'0')+(a[1]-'0')-(10*(a[0]-'0')+(a[1]-'0'))%13)/13,(10*(a[0]-'0')+(a[1]-'0'))%13);}
else
{d[0]=((a[0]-'0')*10+(a[1]-'0'))%13;
b[0]=((a[0]-'0')*10+(a[1]-'0')-d[0])/13;
for(i=1;i<=m-2;i++)
{d[i]=(d[i-1]*10+(a[i+1]-'0'))%13;
b[i]=(d[i-1]*10+(a[i+1]-'0')-d[i])/13;}
if(b[0]!=0)
printf("%d",b[0]);
for(i=1;i<=m-3;i++)
printf("%d",b[i]);
printf("%d\n",b[m-2]);
printf("%d",d[m-2]);}
}
int main()
{
    char a[100],c[100];
    int l,b[100]={0};
    scanf("%s",a);
    l=strlen(a);
    for(int i=0;i<l;i++)
    b[i]=a[i]-'0';
    if(l!=1)
    {
    for(int j=0;j<l-1;j++)
    {
            a[j]=(b[j]*10+b[j+1])/13+'0';
            b[j+1]=(b[j]*10+b[j+1])%13;
    }
    a[l-1]='\0';
    if(a[0]=='0'&&l!=2)
    {
                 for(int k=1;k<l;k++)
                 a[k-1]=a[k];
    }
    printf("%s\n%d",a,b[l-1]);
    }
    else
    printf("0\n%d",b[0]);
    getchar();
    getchar();
}
//***********************
//*?????? **
//*???3.cpp **
//*???2012.11.13**
//***********************
int main()
{
	char a[101];                                          //??????????????
	int b[101], i = 0, r, c[100];                         
	cin >> a;                                                 //?????
	int n = strlen(a);                                    //??????????
	while (a[i] != '\0')                                  //????????
	{
		b[i] = a[i] - '0';
		i ++;
	}
	r = b[0];                      //???r????????
	if (n <= 2 && (b[0] * (n - 1) * 10 + b[1]) < 13)              //???????13
	{
		cout << "0" << endl;
		for (i = 0; i < n; i++)
			cout << b[i];
	}
	else
	{
		for (i = 1; i < n; i ++)
		{
			c[i] = (r * 10 + b[i]) / 13;                        //???
			if (c[i] == 0 && i == 1)                              //??????????0??????
			{
				i ++;
				c[i] = (r * 100 + b[1] * 10 + b[i]) / 13;
				r = (r * 100 + b[1] * 10 + b[i]) % 13;
			}
			else                                                     //????0????
				r = (r * 10 + b[i]) % 13;
		}
		if (c[1] == 0)                                           //????????0???0?????
		{
			for (i = 2; i < n; i++)
				cout << c[i];
		}
		else                                                      
		{
			for (i = 1; i < n; i++)
				cout << c[i];
		}
		cout << endl << r;                                        //??????
	}
	return 0;
}
void trans(char *s,int *p)
{
     int n,i;
     n=strlen(s);
     for(i=0;i<n;i++)
         p[i]=s[i]-'0';
}
main()
{
    char str[110];
    int a[110]={0},b[110]={0};
    int i,j,k,n;
    scanf("%s",str);
    trans(str,a);
    n=strlen(str);
    for(i=0;i<n-1;i++)
    {
        b[i+1]=(10*a[i]+a[i+1])/13;
        a[i+1]=(a[i+1]+10*a[i])%13;
    }
    for(j=0,k=0;j<n;j++)
    {
        if(b[j]!=0)
        {
            k++;
            break;
        }
    }
    if(k==0)
        printf("0\n");
    else
    {
        for(i=j;i<n;i++)
            printf("%d",b[i]);
        printf("\n");
    }    
    printf("%d\n",a[n-1]);
    }
int main()
{
	char name[10];
    char num[101];
	int i ,j ,k;
	while(cin>>num)
	{
                    k=0;
                    int num2[100];
                    for(i=0;i<100;i++)
                    num2[i]=0;
                    
                    i=0;
                    for(i=0;num[i]!='\0';i++)
                    {
                     num2[i]=(k*10+num[i]-'0')/13;
                     k=(k*10+num[i]-'0')%13;
                     
                     }
                     if(strlen(num)<=2&&((num[0]-'0'==1&&num[1]-'0'<=2)
                     ||(num[1]=='\0')))
                     cout<<"0";
                     if(num[0]=='1'&&(num[1]-'0')<=2)
                     for(i=2;i<=strlen(num)-1;i++)
                     {
                                cout<<num2[i];
                                }
                     else
                     for(i=1;i<=strlen(num)-1;i++)
                     {
                                cout<<num2[i];
                                }
                                cout<<endl;
                                cout<<k<<endl;               
}
	return 0;
}
int main()
{
    char a[110];
    cin>>a;
    int b[110];
    int temp=0;
    if(strlen(a)<=5)
    {
                    int t=atoi(a);
                    cout<<t/13<<endl;
                    cout<<t%13<<endl;
    }//???????? 
    else
    {
         for(int i=0;i<strlen(a);i++)
        {
                temp=temp*10+(a[i]-'0');
                b[i]=temp/13;
                temp=temp%13;
        }//???? 
        if(b[1]!=0)
        {
                   cout<<b[1];
        }
        for(int i=2;i<strlen(a);i++)
        {
                cout<<b[i];
        }
        cout<<endl<<temp<<endl;
    }   
    return 0;
}
int main()
{
	char a[100];
	cin>>a;
	int b[100],shang[100];
	int len=strlen(a);
	if(len==1){
		cout<<'0'<<endl;
		cout<<a<<endl;
		return 0;
	}
	int i=0;
	for(i=0;i<len;i++)
		b[len-1-i]=(int)a[i]-48;
	if(len==2&&b[1]*10+b[0]<13){
		cout<<'0'<<endl;
		cout<<b[1]*10+b[0]<<endl;
		return 0;
	}
	int left=b[len-1];
	int sum=0;
	for(i=len-2;i>=0;i--){
		sum=left*10+b[i];
		shang[i]=sum/13;
		left=sum%13;
	}
	int temp=len-2;
	if(shang[temp]==0)temp--;
	for(i=temp;i>=0;i--)
		cout<<shang[i];
	cout<<endl;
	cout<<left<<endl;
	return 0;
}
main()
{
	char a[200];
    int b[200];
	scanf("%s",a); 
	
      int num=0,i,m=0;
      for (i=0;a[i]!='\0';i++)
	
		{
			num=num*10+a[i]-'0';
			int d ,e;
			if (num>=13)
			{
				d=num%13;
				if (d==0)
				{
					e=num/13;
					b[i]=e;
					num=0;
				}
				else
				{
					e=(num-d)/13;
					b[i]=e;
					num=d; 
				}
			}
			else
			{
                num=num;
			    b[i]=0;
             }
            m++; 
		}
	int yu;
	yu =num;
      
      if (m==1)
      {   
        printf ("%d\n",b[0]);
        printf ("%d",yu);       
               }    
      else 
      {
           if (m==2)
          {
           printf ("%d\n",b[1]);
           printf("%d",yu);
           }      	
          else    
          {
          int s,l=0;
          for (s=0;b[s]==0;s++)
          l++;
          int r ;
          for (r=l;r<=m-1;r++)
          printf ("%d",b[r]);
        
          printf("\n%d",yu);	
          }  	
      }
		}
int main()
{
	char c;
	int i, flag = 0, cnt = 0, k;
	while (cin >> c)
	{
		cnt = cnt * 10 + (c - '0');
		k = cnt / 13;
		if (k == 0)
			{
				if (flag) cout << k;
				
			}
		else {cout << k; flag = 1;}
		cnt = cnt - k * 13;
	}
	if (!flag) cout << 0;
	cout << endl << cnt << endl;
	
	return 0;
}
int main()
{
	char m[100];
	int n[100],t[100];
	int l,i,a,b;
	scanf("%s",m);
	l=strlen(m);
    for(i=0;i<=l-1;i++)
		n[i]=m[i]-'0';
	if(l>=3)
	{
	for(i=0;i<=l-2;i++)
	{
		t[i+1]=(n[i]*10+n[i+1])/13;
		n[i+1]=(n[i]*10+n[i+1])%13;
	}
	if(t[1]==0)
	{
	for(i=2;i<=l-1;i++)
	{
		printf("%d",t[i]);
	}
	}
	else
	{
    for(i=1;i<=l-1;i++)
	{
		printf("%d",t[i]);
	}
	}
	printf("\n");
	printf("%d",n[l-1]);
	}
	else if(l==2)
	{
		a=(n[0]*10+n[1])/13;
		b=(n[0]*10+n[1])%13;
		printf("%d\n",a);
	    printf("%d",b);
	}
	else
	{
		printf("0\n");
		 printf("%d",n[0]);
	}
	return 0;
}
main()
{
      char a[100];
      int b,i;
      scanf("%s",a);  
      for(i=0;a[i+1]!='\0';i++)
      {
             b=10*(a[i]-'0')+a[i+1]-'0';             
             a[i+1]=b%13+'0';
             a[i]=b/13+'0';
             if(a[0]!='0'||a[2]=='\0')
             printf("%c",a[i]);
             a[0]++;           
      }
      if(a[1]=='\0')
      printf("0\n%c",a[0]);
      else printf("\n%d",b%13);   
}
int main()
{	char a[1000];
	gets(a);
	int num,shang[1000],yushu[1000];
	num=strlen(a);
	int i,j=1,k=0;
	int b=0,c,d;
	if(num==1)
	{
		for(i=0;i<=num-1;i++)
		{	
		printf("0\n");
		printf("%d",a[i]-'0');
		}
	}
	else
	{for(i=0;i<=num-2;i++)
	{
		if(i==0)
		{
			b=(a[i]-'0')*10+(a[i+1]-'0')*1;
			shang[i]=b/13;
			yushu[i]=b%13;
		}
		else
		{
			b=yushu[i-1]*10+(a[i+1]-'0')*1;
			shang[i]=b/13;
			yushu[i]=b%13;

		}
	}


		for(i=0;i<=num-2;i++)
	{
		if(i==0&&num==2&&shang[i]==0)
			printf("%d\n",shang[i]);
		if(i==0&&shang[i]!=0&&num!=2)
			printf("%d",shang[i]);
		if(i==0&&shang[i]!=0&&num==2)
			printf("%d\n",shang[i]);
		if(i!=0)
		{
			if(i==num-2)
			{
				printf("%d\n",shang[i]);
			}
			else 
				printf("%d",shang[i]);
		}

	}
 printf("%d",yushu[num-2]);
}
 
	return 0;
}
void f(char a[],char b[],char result[]);
int num[100]={0};
int main()
{
 char str[200],str2[200],result[200];
 int i,j,k=0;
 gets(str);
if(strlen(str)==1||(strlen(str)==2)&&str[0]=='1'&&str[1]<'3'){cout<<0<<endl;cout<<str;}
else{
 str2[0]='1';str2[1]='3';
 for(i=2;i<strlen(str);i++)
 {
  str2[i]='0';
 }str2[i]='\0';
 while(strlen(str2)>=2)
 {
  while(strlen(str)>strlen(str2)||(strcmp(str,str2)!=-1&&strlen(str)==strlen(str2)))
  {                        
   num[k]++;
   f(str,str2,result);
   strcpy(str,result);
  }
  k++;
  str2[strlen(str2)-1]='\0';
 }
 //cout<<"The result is:"<<endl;
if(num[0]==0){
 for(i=1;i<k;i++)
  cout<<num[i];
 cout<<endl;
 cout<<str;}
else
{for(i=0;i<k;i++)
  cout<<num[i];
 cout<<endl;
 cout<<str;}}

 return 0;
}

void f(char a[],char b[],char result[])
{
 if(strcmp(a,b)==0){result[0]='0';result[1]='\0';return;}
 else{
 int la=strlen(a);
 int lb=strlen(b);
 int t=0,c=0,s;
 char tmp;
 while(la>=0)
 {
  //cout<<"f function: a["<<la<<"]="<<a[la]<<",  b["<<lb<<"]="<<b[lb]<<endl;
  if(lb<0)s=a[la--]-'0';
  else s=a[la--]-b[lb--];
  result[t++]=s-c+'0';
  if (result[t-1]<48){result[t-1]+=10;c=1;}
  else c=0;
 }
 while(result[t-1]=='0'){result[t-1]='\0';t--;}
 int lresult=t-1;
 for(int i=0;i<=lresult/2;i++)
 {
  tmp=result[i];
  result[i]=result[lresult-i];
  result[lresult-i]=tmp;
 }result[lresult]='\0';
 }
}
int main()
{
  char c[100];
  char s[100];
  int a[100];       
  scanf("%s",c);
  int i;
  for(i=0;i<100;i++)
  {
   if(c[i]!='\0')
   a[i]=c[i]-'0';
   else if(c[i]=='\0')
   break;
  }
  int d=0;
  int j;
  int k=0;
  for(j=0;j<i;j++)
  {
    d=a[j]+d*10;
    if(d>=13)
    {
     s[k]=d/13+'0';
     k++;
     d=d%13;
    } 
    else if(k!=0)
     {
         s[k]='0';
         k++;
     }
  }
   s[k]='\0';
   if(i==1)
  { 
       s[0]='0';
       s[1]='\0';
       d=a[0];
       }
  else if((i==2)&&(a[0]*10+a[1]<13))
  {
       s[0]='0';
       s[1]='\0';
       d=a[0]*10+a[1];
       
       }
   printf("%s\n",s);
   printf("%d\n",d);
   }
main()
{
      char s[1000];
      int b[1000];
      int l,n,i,j;
      gets(s);
      l=strlen(s);
      n=0;
      for (i=0;i<=l-1;i++)
      {
          n=n*10+s[i]-48;
          b[i]=n/13;
          n=n%13;
      }
      j=0;
      while ((b[j]==0)&&(j<=l-1)) j++;
      if (j==l) j--;
      for (i=j;i<=l-1;i++)
      printf("%d",b[i]);
      printf("\n");
      printf("%d",n);
}
main()
{
    char str1[1000];
    char str2[1000];
    char c;
    int m,i,a,b,no,d;
    no=1;
    scanf("%s",str1);
    a=str1[0]-48;
    b=strlen(str1);
    d=str1[1]-48;
    if(a<2&&b==2&&d<3)printf("0");
    if(a<10&&b<2)printf("%c\n%d",'0',a);
    else
    {
        for(i=0;;i++)
     {
                          m=(str1[i]-48)*10+(str1[i+1]-48);
                          str2[i]=m/13+48;
                          str1[i+1]=m%13+48;
                          if(no==1)
                          {
                                   if(str2[i]!='0')printf("%c",str2[i]);
                                   no=0;
                          }
                          else printf("%c",str2[i]);
                          if(str1[i+2]=='\0') break;
     }
    
     printf("\n");
     c=str1[i+1];
   //  if(c<10) printf("%c\n",c);
	  printf("%d\n",c-48);
    }
    return 0;
 }
/*
 * main.cpp
 *
 *  Created on: 2012-10-15
 *      Author: ??
 *  ??????
 */

int main()
{
	int  numerator [110],quotient[110];
	int i,j,t=0;
	char a[110];

	cin>>a;//???????????
	for (i=0;i<strlen(a);i++)
		numerator[i+1]=a[i]-48;//?????
	for (i=1;i<=strlen(a);i++)
	{
		quotient[i]=(t*10+numerator[i])/13;//?????
		t=(t*10+numerator[i])%13;//??
	}
	i=1;
	while ((quotient[i]==0) && (i<strlen(a))) i++;//?????0
	for (;i<=strlen(a);i++)
		cout<<quotient[i];
	cout<<endl<<t<<endl;
	return 0;
}
char chufa1(char a,char b);
char chufa2(char a,char b);
char chufa3(char a,char b,char c);
char chufa4(char a,char b,char c);

main()
{
    char a[100],d,e,f,g;
    scanf("%s",a);
    int i=0,j=0,k=0;
    j=strlen(a);
    if(j==1||(j==2 && a[0]=='1' && (a[1]=='0'||a[1]=='1'||a[1]=='2')))
    {
        printf("0\n%s",a);
        getchar();
        getchar();
        return 0;
    }   
    for(i=0;i<j;i++)
    {
        a[i]=a[i]-'0';
    }

    if(a[0]==1&&a[1]<3)
    {
        k=1;
        d=chufa3(a[0],a[1],a[2]);   
        e=chufa4(a[0],a[1],a[2]);
        a[1]=d;
        a[2]=e;
        i++;
        for(i=2;i<j-1;)
        {
            if(a[i]>1||(a[i+1]>2&&a[i]==1))
            {
                 d=chufa1(a[i],a[i+1]);
                 e=chufa2(a[i],a[i+1]);
                 a[i]=d;
                 a[i+1]=e;
                 i++;                    
            }
            else
            {
                 if(i+2==j)
                 break;
                 d=chufa3(a[i],a[i+1],a[i+2]);   
                 e=chufa4(a[i],a[i+1],a[i+2]);
                 a[i]=0;
                 a[i+1]=d;
                 a[i+2]=e;
                 i=i+2;
            }
            d=0;
            e=0;                
        }
    }
    else
    for(i=0;i<j-1;)
    {   
        if(a[i]>1||(a[i+1]>2&&a[i]==1))
        {
            d=chufa1(a[i],a[i+1]);
            e=chufa2(a[i],a[i+1]);
            a[i]=d;
            a[i+1]=e;
            i++;                    
        }
        else
        {
             if(i+2==j)
             break;
             d=chufa3(a[i],a[i+1],a[i+2]);   
             e=chufa4(a[i],a[i+1],a[i+2]);
             a[i]=0;
             a[i+1]=d;
             a[i+2]=e;
             i=i+2;
        }
        d=0;
        e=0;                
    }
    if(k==0)
    {
        for(i=0;i<j-1;i++)
        {
            a[i]=a[i]+'0';
            printf("%c",a[i]);                  
        }
        if(a[i]<10)
        {
            a[i]=a[i]+'0';
            printf("\n%c",a[i]);
        }
        else 
        {
            f=a[i]/10;
            g=a[i]%10;
            f=f+'0';
            g=g+'0';
            printf("\n%c%c",f,g);
        }
    }
    else
    {
        for(i=1;i<j-1;i++)
        {
            a[i]=a[i]+'0';
            printf("%c",a[i]);                  
        }
        if(a[i]<10)
        {
            a[i]=a[i]+'0';
            printf("\n%c",a[i]);
        }
        else
        {
            f=a[i]/10;
            g=a[i]%10;
            f=f+'0';
            g=g+'0';
            printf("\n%c%c",f,g);
        }
    }    
    return 0;        
}

char chufa1(char a,char b)
{
    unsigned char n,d;
    n=10*a+b;
    d=n/13;
    return(d);    
}

char chufa2(char a,char b)
{
    unsigned char n,e;
    n=10*a+b;
    e=n%13;
    return(e);    
}

char chufa3(char a,char b,char c)
{
    char n,d;
    n=100*a+10*b+c;
    d=n/13;
    return(d);    
}

char chufa4(char a,char b,char c)
{
    char n,e;
    n=100*a+10*b+c;
    e=n%13;
    return(e);    
}
char li[110];
char up[110];
int num=0;
void chu(int i)
{
	int bc;
	bc=(li[i]-'0')*100+(li[i+1]-'0')*10+li[i+2]-'0';
	int yu;
	int jie;
	jie=bc/13;
	yu=bc%13;
	if(num==0&&jie>10)
	{
		
			up[num]=jie/10+'0';
			num=num+1;
			up[num]=jie-jie/10*10+'0';
			num=num+1;
		
	}
	else
	{
		up[num]=jie+'0';
		num=num+1;
	}
	li[i]=0+'0';
	if(yu>10)
	{
		li[i+1]=yu/10+'0';
		li[i+2]=yu-10+'0';
	}
	else
	{
		li[i+1]='0';
		li[i+2]=yu+'0';
	}
}
int main()
{
	memset(li,'\0',sizeof(li));
	memset(up,'\0',sizeof(up));
	while(cin>>li)
	{
		
		num=0;
		int len;
		len=strlen(li);
		if(len>3){
		for(int j=0;j<len-2;j++)
		{
			chu(j);
		}
		cout<<up<<endl;
		if(li[len-2]=='1') cout<<'1';
		cout<<li[len-1]<<endl;}
		else 
		{
			int t;
			t=atoi(li);
			cout<<t/13<<endl;
			cout<<t%13<<endl;
		}
		memset(li,'\0',sizeof(li));
		memset(up,'\0',sizeof(up));
	}
	
	return 0;
}