#include<stdio.h>
#include <stdbool.h>
int main()
{
	int n,arr[100],i,j,ans[50],t=0;
	bool b;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	scanf("%d",&arr[i]);

	for(i=0;i<n;i++)
	{
		b=false;
		for(j=i+1;j<n;j++)
		{
			if(arr[i]==arr[j])
               b=true;
		}
		if(b==false)
		ans[t++]=arr[i];
	}
	printf("%d\n",t);
	for(i=0;i<t;i++)
	printf("%d ",ans[i]);

	return 0;

}


#include<stdio.h>
void main()
{
int t[4] ;
int i,j ;
for(i=0;i<4;i++) scanf("%d",&t[i]) ;
for(i=0;i<3;i++){
	for(j=i+1;j<4;j++){
		if (t[i]<t[j]){
			t[i]=t[i]+t[j] ;
			t[j]=t[i]-t[j] ;
			t[i]=t[i]-t[j] ;
		}
	}
}
int c = t[0]-t[1]-t[2] ;
int d = t[1]-t[2]-t[3];
if(c<0){
	printf("TRIANGLE") ;
}else if(c==0){
			if(d<0){
				printf("TRIANGLE") ;
			} else
			printf("SEGMENT") ;
}else{
			if(d<0){
			printf("TRIANGLE") ;
			}else if(d==0){
			printf("SEGMENT") ;
			}else
 			printf("IMPOSSIBLE") ;
}
}


#include<stdio.h>

int comp(const void *p,const void *q)
{
	return (int *)p-(int *)q;
}
int main()
{
	int n,k;
	int i,j;
	int a[51];
	int flag=0;
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}

	for(i=0;i<n;i++)
	{
		if(a[i]<=k)
			break;
	}
		printf("%d",i);

	getch();
}


#include <stdio.h>
#include <string.h>
int main()
{
    int str[999], str1[999];
    while(scanf("%s %s", str, str1))
    {
        if(strcmp(str, str1)==0) printf("%s\n", str1);
        else printf("%s\n", str);
    }
    return 0;
}


#include <stdio.h>
int main()
{
int n,k,i=0,j,a[50];
int sum=0;
scanf("%d %d",&n,&k);
for(j=0;j<n;j++)
scanf("%d",&a[j]);
for(j=0;j<n;j++)
sum=sum+a[j];
while(1)
{
	float l;
	l=n/2;
	if(sum<(k*n-l))
	{
		i++;
		sum=sum+k;
		n++;
		//printf("%d",i);
	}
	else
	break;
}
printf("%d",i);
}


#include <stdio.h>
#include <stdlib.h>

int main() {
	int size, i, min_v, min_p, lvl;
	int v[100], diff[100];

	scanf("%d", &size);

	if(size < 3 || size > 1000)
		return 1;

	min_v = 1000;
	min_p = -1;
	lvl = 0;

	for(i = 0; i < size; i++) {
		scanf("%d", &v[i]);
		if(i > 0) {
			diff[i] = v[i] - v[i-1];
			if(min_v > diff[i] && i < size - 1) {
				min_v = diff[i];
				min_p = i;
			}

			if(lvl < diff[i])
				lvl = diff[i];
		}
	}

	v[min_p] = v[min_p - 1];
	if(lvl < v[min_p+1] - v[min_p])
		lvl = v[min_p+1] - v[min_p];

	printf("%d\n", lvl);

	return 1;
}


#include<stdio.h>
#include<string.h>
int main(){int count=0;
char s[101];
scanf("%s",s);
int dif=s[0]-'a';
if(dif<0){dif=dif*(-1);}
if(dif>13){
 count=26-dif;}
 else{count=dif;}
int i=1;
while(s[i]!='\0'){
    dif=s[i]-s[i-1];
    if(dif<0){dif=dif*(-1);}
    if(dif>13){
 count=26-dif+count;}
 else{count=dif+count;}
}
printf("%d",count);
}


#include<stdio.h>
int main()
{
	int n,a,t[104],i,left,right,ans=0,flag1=0,flag2=0;
	scanf("%d%d",&n,&a);
	left=a-1;
	right=a-1;
	for(i=0;i<n;i++)
		scanf("%d",&t[i]);
	if(n==1)
	{
		if(t[0]==1)
			printf("1\n");
		else printf("0\n");
		return 0;
	}
	if(t[a-1]==1)
		ans++;
	while(left>=0 || right<n-1)
	{
		flag1=0;
		flag2=0;
		if(left>0)
		{
			left=left-1;
			flag1=1;
		}
		if(right<n-1)
		{
			right=right+1;
			flag2=1;
		}
		if(t[left]==1 && t[right]==1 && flag1==1 && flag2==1)
			ans=ans+2;
		else if(flag1==0 && flag2==1)
		{
			if(t[right]==1)
				ans=ans+1;
			left=left-1;
		}
		else if(flag2==0  && flag1==1 && t[left]==1)
		{
			ans++;
			left=left-1;
		}
	}
	printf("%d\n",ans);
	return 0;
}


#include<stdio.h>
int main()
{
    while(1){
    int n,m;
    scanf("%d %d",&n,&m);
    if(m==0) printf("1");
    else if(n==m) printf("0");
    else if(n/m==2||n/m>2) printf("%d",m);
    else if(n/m<2) printf("%d",(n-m));
    }
}


#include <stdio.h>
void main() {
long int n;
long int k;
long int rest;
long int res;
scanf("%d %d", &n, &k);

rest = n % k;
res = n - rest + k;

printf("%d", &res);

}


#include <stdio.h>
#include <string.h>

typedef long long LL_t;

int GetSn(LL_t num)
{
	int res=0;
	while(num)
	{
		num/=10;
		++res;
	}
	return res;
}

int main()
{
    int Sn,i,k;
    LL_t w,m,Max,Ans=0;
    scanf("%I64d %I64d %d",&w,&m,&k);
	while(w)
	{
		Sn=GetSn(m);
		Max=1;
		for(i=0;i<Sn;++i)
		{
			Max*=10;
		}
		if(w<=(Max-m)*Sn*k)
		{
			Ans+=w/((LL_t)k*Sn);
			w=0;
		}
		else
		{
			Ans+=Max-m;
			w-=(Max-m)*Sn*k;
		}
		m=Max;
	}
	printf("%I64d\n",Ans);
    return 0;
}


#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d",&a,&b);
    c=a/b;
    while (a>0)
    {

    if(a%b>=0 && c%2!=0) printf("YES\n");
    else if(a%b==0 && c%2==0) printf("NO\n");
    else printf("NO\n");
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<conio.h>
int main()
{
    long long n,i=0;    int c=0;
    scanf("%l64d",&n);
    while(n>0)
    {
        i=n%10;
        if(i==4 || i==7)
        {
            c++;
        }
        n=n/10;
    }
    if(c==4 || c==7)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }
    getch();
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
	int n;
	scanf("%d",&n);
	int *array;
	array=(int*)calloc(n+1,sizeof(int));
	int i,j;
	for(i=1;i<n+1;i++)
	{
		scanf("%d",&array[i]);
		//printf("%d ",array[i]);
	}
	for(j=1;j<n+1;j++)
	{
		if(array[j]-array[j-1]>15)
		{
			printf("%d",array[j-1]+15);
			free(array);
			exit(1);
		}
	}
	//printf("%d ",j);
	int max=90;
	if(array[j-1]>84)
	{
		printf("%d",max);
	}
	else
	{
		printf("%d",array[j-1]+15);
	}
	free(array);
}


#include<stdio.h>
int main()
{
    long long int n,k,i,j=0,ch[100000000],count=0,b;
    scanf("%lld %lld",&n,&k);
    for(i=1;i<=n;i++)
    {
        if(n%i==0)
            {ch[j]=i;
        j++;}
    }

    if(k>j)
        printf("-1\n");
    else
        printf("%lld\n",ch[k-1]);
}


#include<stdio.h>
main()
{
    char s[101];
    gets(s);
    int capital=0,small=0,i;
    for(i=0;s[i]!='\0';i++)
    {
        if(s[i]>=65 && s[i]<=90)
        {
            capital++;
        }
        else if(s[i]>=97 && s[i]<=122)
        {
            small++;
        }
    }
    if(capital>small)
    {
        strupr(s);
    }
    else
    {
        strlwr(s);
    }
    printf("%s\n",s);
    getch();
    return 0;
}


#include <stdio.h>
void main()
{
    int n,c=0;
    scanf ("%d",&n);
    for (int i=2;i<=n;i++)
    {
        if (n%i==0)
        {
            if(c==0)
            {
                printf("%d%d",i,n/i);
                c++;
            }
        }
    }
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    long long int n,val=1000000007;
    scanf("%lld",&n);
    long long int steps[10000005]={0};
     steps[1]=0;
    for(int i=2;i<=n;i++)
    {
        steps[i]=powl(3,i-1)-steps[i-1];
    }
    printf("%lld",steps[n]%val);
    return 0;
}


#include <stdio.h>

int main(){
   int flyes[2][3];
   int i,diffs=0;
   for(i = 0; i<3; i++)
      scanf("%d",&flyes[0][i]);
   for(i = 0; i<3; i++)
      scanf("%d",&flyes[1][i]);
   for(i = 0; i<3; i++){
      if(flyes[0][i]!=flyes[1][i])
	 diffs++;
   }
   if(diffs<=1)
      printf("YES");
   else
      printf("NO");

   return 0;
}


#include <stdio.h>
#include <stdlib.h>

struct pair
{
	int a, b;
};

int cmp ( const struct pair *a, const struct pair *b )
{
	if ( a->a == b->a )
		return a->b - b->b;
	return a->a - b->a;
}

struct pair *p, temp;
int n, i, j;
int a, b;

int main ()
{
	scanf ( "%d", &n );
	if ( n <= 2 )
	{
		puts ( "no" );
		return 0;
	}

	p = (struct pair *)malloc(sizeof(struct pair)*103);

	scanf ( "%d%d", &a, &b );
	p[0].a = a;
	p[0].b = b;
	a = b;

	for ( i = 2; i < n; ++ i )
	{
		scanf ( "%d", &b );
		p[i-1].a = a;
		p[i-1].b = b; a = b;
		if ( p[i-1].a > p[i-1].b )
		{
			p[i-1].a += p[i-1].b;
			p[i-1].b = p[i-1].a - p[i-1].b;
			p[i-1].a = p[i-1].a - p[i-1].b;
		}
	} -- n;

	qsort ( p, n, sizeof(struct pair), cmp );

	//for ( i = 0; i < n; ++ i )
	//	printf ( "%d - %d\n", p[i].a, p[i].b );

	for ( i = 0; i < n-1; ++ i )
	{
	//	printf ( "i = %d\n", i );
		for ( j = i+1; j < n; ++ j )
		{
	//		printf ( " j = %d\n", j );
			if ( p[j].a > p[i].b ) break;
			if ( p[i].b > p[j].a && p[i].a < p[j].a && p[j].b > p[i].b )
			{
	//			printf ( "%d-%d\n", p[i].a, p[i].b );
				puts ( "yes" );
				return 0;
			}
		}
	}

	puts ( "no" );

	return 0;
}


#include<stdio.h>
int main()
{
    char s[8][8];
    int i, j, count = 0, count1 = 0, c;
    for(i = 0; i < 8; i++)
    {
        gets(s[i]);
        count = 0;
        for(j = 0; s[j] != '\0'; j++)
        {
            if(s[i][j] == 'B')
                count++;
        }
        if(count == 8)
            count1++;
        else
            c = count;
    }
    printf("%d", c + count1);
}


#include <stdio.h>
int main()
{
	int a,b,c,n;
	scanf("%d %d",&a,&b);
	scanf("%d %d",&c,&n);
	n=n-a-b+c;
	if(n>0)
	printf("%d",n);
	else
	printf(-1);
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    long long int k,b,t;
    int i,n ,x=1,sec=0;
    scanf("%I64d %I64d %I64d %I64d",&k,&b,&n,&t);
    for (i=0; x<t; i++)
       { x = k*x +b;}
    if (i>n)
    {
        printf("0");
        return 0;
    }
    else if (t==x)
    {
        sec =n-i;
        printf("%d",sec);
    }
    else if (x>t)
    {
        sec= n-i+1;
        printf("%d\n",sec);
    }
    return 0;
}


#include<stdio.h>
#include<conio.h>
int main()
{int a;
char b[1000];
printf("enter string");
scanf("%s",b);
a=b[0];
if(a>=97)
b[0]=a-32;
puts(b);
getch();
}


#include<stdio.h>
#define int long long int
int answer(int n){
	if(n%2==0)
		return n/2;
	for(int i=3;i*i<n;i++){
		if(n%i==0)
			return n/i;
	}
		return 1;
}
int main(){
	int n,no;
	scanf("%lld",&n);
	no=answer(n);
	printf("%lld\n",no);
}


#include<stdio.h>
int main()
{
    int n,k,count=0;
    scanf("%d%d",&n,&k);

    while(k!=0)
    {
        if(n%10!=0)
        {
        n--;
        }
        else
        {
            n/=10;
        }
        count++;
        if(count==k)

    printf("%d",n);
}
}


#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
void main()
{ int n,i,j;n=scanf("%d",&n);int s=0;
  int arr[100];s=0;
 for(i=0;i<n;i++)
 { scanf("%d",&arr[i]);s=s+arr[i];
 }
 int a=(s*2)/n;
 for(i=0;i<n;i++)
 {
   for(j=i;j<n;j++)
     { if(((arr[i]+arr[j])==a)&&(arr[i]>=0)&&(arr[i]>=0))
       {printf("%d   %d",i,j);
         arr[i]=-1;arr[j]=-1;break;
	 }}
 }getch();
	 }


#include<stdio.h>
int main()
{
int i,s;
scanf("%d",s);
char s[100];
gets(s);
{
if(s[i]==0)
{
printf("EASY");
}
else if(s[i]==1)
{
}
printf("HARD");
}
return 0;
}


#include<cstdio>
int main()
{
    int a=0,b=0,c=0;
    char ch;
    while(ch=getchar())
    {
        if(ch=='1')
            a++;
        else  if(ch=='2')
            b++;
        else if(ch=='3')
            c++;
        else if(ch=='\n')
            break;
    }
    bool first=true;
    for(int i=0;i<a;i++)
    {
        if(first==true)
        {
            printf("1");
            first=false;
        }
        else
            printf("+1");
    }
    for(int i=0;i<b;i++)
    {
        if(first==true)
        {
            printf("2");
            first=false;
        }
        else
            printf("+2");
    }
    for(int i=0;i<c;i++)
    {
        if(first==true)
        {
            printf("3");
            first=false;
        }
        else
            printf("+3");
    }
    printf("\n");
    return 0;.
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
	int N,i,value,len=1,total=0,j=1;
	int *a,*index;

	scanf("%d",&N);
	a=(int *)malloc(sizeof(int)*N);
	index=(int *)malloc(sizeof(int)*N);

	for (i = 0; i < N; ++i)
	{
		scanf("%d",&a[i]);
		total+=a[i];
	}

	value=a[0];
	index[0]=1;
	for(i=2;value<=total/2 && i<=N;i++)
	{
		if(a[0]/2>=a[i-1])
		{
			value+=a[i-1];
			index[j]=i;
			len++;
			j++;
		}
	}

	if((len==1 && i!=2 )|| (value<total/2 && i==N+1))
	{
		printf("0");
		return 0;
	}

	printf("%d\n",len);

	for (i = 0; i < len; ++i)
	{

		printf("%d ",index[i]);
	}
}


#include <stdio.h>
#include <math.h>
int main()
{int n;
 scanf("%d",&n);
 int a=n%4;
 if(a!=0)
 int b=(pow(8,a))%10;
 else
 b=6;
 printf("%d",b);
 return 0;
}


int main(){
    int n;
    //scanf("%d",&n);
    if(n%2!=0) return 0;
    int rect=(n%4!=0)?n/4:n/4-1;
    pritnf("%d\n",rect);
}


#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
long long int n,k,k1,k2;
scanf("%lld",&n);
k=pow(5,n);
if(k<=25)
    printf("%lld\n",(k+1);
else
{
    k1=k%10;
    k=k/10;
    k2=k%10;
    k=(k2*10)+k1;
    printf("%lld\n",(k+1));
}
    return 0;
}


#include<stdio.h>
int main(){
    int m,n,a,b,p;
    float d,c=0.0,e;
    scanf("%d %d %d %d",&n,&m,&a,&b);
    t=n;
    d=(float)b/m;

        if(d<(float)a)
        {
            c=c+d;
            c*=n;
        }
        else {
            c+=a; c*=n;}

    e=c-(int)c;
    if(e!=0.0) c=c+1;

    p=(int)c;
    printf("%d",p);
    return 0;
}


#include<iostream>
#include<math.h>
using namespace std;
int judge(int a);
int judge(int a) {
	int i;
	for (i = 2; i <= sqrt(a); ++i)
		if (a%i == 0)
			return 0;
	return 1;
}
int main() {
	int n, m;
	char nothing;
	cin>>n;
	for (m = 1;; ++m)
		if (!judge(m*n + 1)) {
			cout << m<<endl;
			break;
		}

}


#include<stdio.h>
int main()
{
    int n,s,i,j,k;
    int a[50];
    scanf("%d%d",&n,&s);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if(a[i]>a[j])
            {
              k=a[i];
              a[i]=a[j];
              a[j]=k;
            }
        }
    }
    int sum=0;
    for(i=0;i<n-1;i++)
    {
        sum+=a[i];
    }
    if(sum>s)
    printf("NO\n");
    else
    printf("YES\n");
    return 0;
}


#include <stdio.h>
int main(){double n; scanf("%f",&n); double i; double s=0;
for(i=0; i<n;i++){if((i+1)%2==0)s+=(i+1);else s-=(i+1);} printf("%.0f",s);
return 0;}


#include <stdio.h>
#include <string.h>
#include <ctype.h>

int main(void)
{
    char c1[101];
    char c2[101];
    int i = 0
    scanf("%s%s",c1,c2);
    for(i = 0; c1[i]!= '¥n'; i++){
        if(isLower(c1[i]))toLower(c1[i]);
        if(isLower(c2[i]))toLower(c2[i]);
        }

    for(i = 0; c1[i]!= '¥n'; i++){
        if((c1[i]-c2[i])>0){
            printf("-1");
            return 0;

        }else if((c1[i]-c2[i])<0){
            printf("1");
            return 0;
        }
            }

    printf("0")

        return 0;

}


#include<stdio.h>
#include<string.h>

int main(){
    char arr[100];
    int i,l,count=0;

    scanf("%s",&arr);
    l= strlen(arr);

    for(i=1;i<l;i++){
        if(arr[i] == arr[i-1]){
            count++;
        }
        }
    }
    printf("%d",count);
    return 0;
}


#include <stdio.h>
#include <string.h>
int dv(int x,int n,int p){
	if(n==1)return (x%p);
return (dv(x,n/2,p)*dv(x,n-n/2,p))%p;
}
int main(){
	int p,c=0,i;
	scanf("%d",&p);
	for(int x=1;x<p;x++){
		for(i=1;i<=(p-2);i++)
			if(dv(x,i,p)==1)break;
		if(i<p-1)continue;
		if(dv(x,i,p)==1)c++;
	}
	printf("%d",c);
}


#include <stdio.h>

int main(int argc, char **argv)
{
	long long int n,x,y;
	unsigned long int a,b;
	scanf("%I64d\n",&n);
	scanf("%I64d\t%I64d",&x,&y);
	a=((x-1)+((y-1));
	b=((n-x)+((n-y));
	if(a<=b)
	{
	    printf("White");
	}
	else
	{
	    printf("Black");
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
int p,max,i,j,s,k;
p=0;
int t[13];
scanf ("%d",&k);
for (i=0;i<=11;i++) { scanf("%d",&t[i]);
}

max=t[0];
s=0;
if (k!=0){

while (s<k) {

for(i=1;i<=11;i++) {
     if(t[i]>= max) {
	    max =t[i];
	    j=i;
    }
}
t[j]=0;
s=s+max;
p=p+1;
}
printf("%d",p);
break ;}
else { printf("%d",0);
}
	return 0;
}


#include<stdio.h>
int main()
{
   int n,i,j,t;
  int a[8][8];
  for(i=0;i<8;i++)
  { for(j=0;j<8;j++)
  {scanf("%d %d",&i,&j);
   if(c[i][j]=='Q')x=x+9;
            else if(c[i][j]=='q')y=y+9;
            else if(c[i][j]=='R')x=x+5;
            else if(c[i][j]=='r')y=y+5;
            else if(c[i][j]=='B')x=x+3;
            else if(c[i][j]=='b')y=y+3;
            else if(c[i][j]=='N')x=x+3;
            else if(c[i][j]=='n')y=y+3;
            else if(c[i][j]=='P')x=x+1;
            else if(c[i][j]=='p')y=y+1;
            else if(c[i][j]=='K')x=x+0;
            else if(c[i][j]=='k')y=y+0;
        }
    }
    if(x>y)printf("White");
    else if(x<y)printf("Black");
    else printf("Draw");
    return 0;
}


#include<stdio.h>
int l,r,x,y;
int gcd(int p,int q){
	int r;
	while(q!=0){
		r=p%q;
		p=q;
		q=r;
	}
	return p;
}
void run(){
	int i,j,k,c;
	while(scanf("%d%d%d%d",&l,&r,&x,&y)!=EOF){
		if(y%x!=0){
			printf("0\n");
			continue;
		}
		j=y/x;
		c=0;
		for(i=1;i<100007&&i<=j;i++){
			if(j%i==0){
				k=j/i;
				if(k<i){
					break;
				}
				if(i*x>=l&&i*x<=r&&k*x>=l&&k*x<=r){
					if(gcd(i,k)==1){
						c+=i==k?1:2;
					}
				}
			}
		}
		printf("%d\n",c);
	}
}
main(){
#ifndef	ONLINE_JUDGE
	freopen("4892b_min.in","rb",stdin);
	freopen("4892b_.out","wb",stdout);
#endif
	run();
	return 0;
}


#include <stdio.h>
int main()
{
    int n,a=0;
    scanf("%d",&n);
    int i,w;
    for(i=0;i<n;i++)
    {
        scanf("%d",&w);
        if(w==100)a++;
    }
    if(a%2==1||(n%2==1&&a==0))printf("NO");
    else printf("YES");
    return 0;


#include <stdio.h>
#include<stdlib.h>

int main()
{
    int n;
    scanf("%d",&n);
    if(n==14||n==1||n==114)
    {
        printf("YES");
        exit(0);
    }
    while(n>0)
    {
        if(n%1000==144)


#include<stdio.h>
int main(){
    int n,m,flag=0;
    scanf("%d%d",&n,&m);
         for(int i=2;i<=m/2;i++){
        if(m%i==0) {flag++;printf("NO");break;}
    }
    if(flag==0){
        for(int i=n+1;i<m;i++){
            for(int j=2;j<=i/2;j++){
                if(i%j==0){flag++;break;}
            }
            if(flag==0&&i<m) {printf("NO");break;}
            flag=0;
        }
        if(i==m)printf("YES");

    }

}


#include<stdi.h>

void main()
{
    int x,y,max=1,i;
    int tab[100];
    scanf("%d"&x);
    scanf("%d"&y);

    for( i=0;i<x;i++)
    {
        scanf("%d"&tab[i]);
        if(tab[i]%y==0 && tab[i]>max)
            max=tab[i]

    }
    printf("%d"y/max);

}


#include <stdio.h>
#include <string.h>

int main ()
{
   int lenght,sumdigit,sum1=1,ind1,sum2=0,ind2=0,i;

   scanf("%d %d",&lenght,&sumdigit);

   if(lenght==1 && sumdigit==0)
   {printf("0 0");return 0;

      if(lenght*9<sumdigit ||sumdigit==0)
   {

       printf("-1 -1");return 0;
   }
   if(lenght==1)
   {
       printf("%d %d",sumdigit,sumdigit);return 0;
   }

    int a1[lenght];

    for(i=lenght;i>0;i--)
        a1[i]=0;
    ind1=lenght-1;
    a1[0]=1;

    int a2[lenght];

    for(i=lenght;i>0;i--)
        a2[i]=0;

    while(1)
    {
        if(sum1+9<=sumdigit)
        {
            a1[ind1]=9;
            sum1+=9;
            ind1--;
        }
        else if(sum1+9>sumdigit && sum1<sumdigit)
        {
            a1[ind1]=sumdigit-sum1;
            sum1+=sumdigit-sum1;
            ind1--;
        }
        else if(sum1==sumdigit)
        {
            a1[ind1]=0;
            ind1--;
        }
        if(ind1==0)
            break;

    }
    a1[0]+=sumdigit-sum1;

    while(1)
    {
        if(sum2+9<sumdigit)
        {
            a2[ind2]=9;
            sum2+=9;
            ind2++;
        }
        else if(sum2+9>sumdigit && sum2<sumdigit)
        {
            a2[ind2]=sumdigit-sum2;
            sum2+=sumdigit-sum2;
            ind2++;
        }
        else if(sum2==sumdigit)
        {
            a2[ind2]=0;
            ind2++;
        }
        if(ind2==lenght+1)
            break;

    }
    for(i=0;i<lenght;i++)
        printf("%d",a1[i]);

    printf(" ");

    for(i=0;i<lenght;i++)
        printf("%d",a2[i]);
    return 0;
    getchar();
}


#include<stdio.h>
int main()
{
	long long int a,b,count1=0;
	scanf("%I64d %I64d",&a,&b);
	else
	{
		while(a!=b)
		{

				count1=count1+(a/b);
				a=b;
				b=a-((a/b)*2);
				if(b<=0||a==0)
					break;
		}
	printf("%I64d",count1);
	}
}


#include<stdio.h>

int main()
{

     int a1,a2,a3,a4;
     scanf("%d %d %d %d", &a1, &a2, &a3, &a4);

 if(a1+a2 == a3+a4) printf("YES");
 else if(a1+a3 == a2+a4) printf("YES");
 else if(a1+a4== a2+a3) printf("YES");
 else if(a1+a2+a3 == a4) printf("YES");
 else if(a2+a3+a4 == a1) printf("YES");
 else if(a3+a4+a1 == a2) printf("YES");
 else if(a1+a2+a4 == a3) printf("YES");
 else printf("NO");


#include <stdio.h>

int main()
{
    int n,a,b,i;

    scanf("%d %d %d", &n, &a, &b);

    for (i=1; i<=a && i<=b && (a/i + b/i >= n); x++);

    printf("%d",i-1);

    return 0;

}


#include <stdio.h>

typedef long long LL;

LL GetSum(LL i,LL K)
{
	return (i+K)*(K-i+1)/2;
}

LL Binary(LL K,LL N)
{
	LL Left=1,Right=K,Mid;
	while(Right>Left)
	{
		Mid=(Left+Right)/2;
		if(GetSum(Mid,K)==N)
		{
			return Mid;
		}
		else if(GetSum(Mid,K)<N)
		{
			Right=Mid;
		}
		else
		{
			Left=Mid+1;
		}
	}
	return Left;
}

int main()
{
	LL N,K,index;
	while(scanf("%I64d %I64d",&N,&K)!=EOF)
	{
		--N;
		if(N>K*(K-1)/2)
		{
			puts("-1");
			continue;
		}
		index=Binary(K-1,N);
		if(GetSum(index,K-1)==N)
		{
			printf("%d\n",K-index);
		}
		else
		{
			printf("%d\n",K-index+1);
		}
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>

int funcelias (char a);

int main()
{
	int i,j=0,k,f,l ;
	int aux[4];
	char hora[6];
	int flag=0 ;
	scanf("%s", hora) ;

	for(i=0;'\0'!=hora[i];i++){

		if(funcelias(hora[i])!=-1){
			aux[j]=funcelias(hora[i]);
			j++;
		}
	}
	if((aux[0]*10+aux[1])<24)
	{
		while(flag!=1){

		for(i=aux[0] ; i<3 && flag==0; i++)
		{
			for(k=aux[1] ; k<4 && flag==0; k++)
			{
				for(j=aux[2] ; j<6 && flag==0; j++)
				{
					for(l=aux[3]+1 ; l<10 && flag==0; l++)
					{
						if(i==l and k==j)
						{
							flag=1 ;
							printf("%d%d:%d%d",i,k,j,l) ;
						}
					}
					aux[3]=-1;
				}
				aux[2]=0;
			}
			aux[1]=0;

		}
		aux[0]=0;

		}
	}
	return 0 ;
}
int funcelias (char a)
{
	int i;

	char numero[]= {'0','1','2','3','4','5','6','7','8','9'}	;
	for(i=0; i<10; i++)
	{

		if(a==numero[i])
		{
			return i;
		}

	}
	return -1;
}


#include <stdio.h>
#include <stdlib.h>
long x ;

int main()
{
   int i=0;
   int j ;
    scanf(" %ld",&x);
    j = x % 8 ;

    switch(j) {
        case 1:case 2:case 4 :
    i=1;  break ;
    case 3:case 5:case 6 :
         i=2 ; break ;
    case 7 :
        i=3; break ;
    case  0 :     i=0;  break ;

    }
     if (x >=8 ) { i= i+1 ; }
    printf("\n%d",i);

    return 0;


/// https://vjudge.net/contest/166123#problem/C
/// careful! faltu code!!!
/// but accepted :3
#include<stdio.h>
#include<math.h>
int main()
{
    long long l,r,i,j;
    int cnt2=0;
    int cnt3=0;
    int cnt5=0;
    scanf("%lld %lld",&l,&r);
    if(l==r)
    {
        printf("%lld",l);
        return 0;
    }
    else if ((r-l)>5)
    {
        printf("2");
        return 0;
    }
    for(i=l; i<=r; i++)
    {
        if(i%2==0)
            cnt2++;
        if(i%3==0)
            cnt3++;
    }
    if(cnt2>cnt3)
        printf("%d\n",cnt2);
    else if
        printf("%d",cnt3);
    else
        printf("2\n");
    return 0;
}


#include<stdio.h>
#include<math.h>
int main(){
    int n;
    scanf("%d", &n);
    char a[n];
    scanf("%s", a);
    char b[n]=a;
    if(a==b){
        printf("hcyrkd");}
    else{
    int i,j,c=0,k;
    k=n;
    while(k!=1){
        k=k/2;
        c++;
    }
    for(i=0;i<=c;i++)
    {
        k=(int)n/pow(2,c-i);
        for(j=0;j<k/2;j++){
            char temp;
            temp=a[j];
            a[j]=a[k-j-1];
            a[k-j-1]=temp;
        }
    }
    printf("%s",a);}
    return 0;
}


#include<stdio.h>
#include<string.h>
#define maxn 2000000000
int not_prime[maxn],prime[100000000];
int cnt=0;
void get_prime(){
	not_prime[1]=1;
	for(int i=2;i<=maxn;i++){
		if(!not_prime[i]) prime[++cnt]=i;
		for(int j=1;j<=cnt;j++){
			if(prime[j]*i>maxn) break;
			not_prime[prime[j]*i]=1;
			if(i%prime[j]==0) break;
		}
	}
}
int main()
{
	memset(not_prime,0,sizeof(not_prime));
	int n,flag=0;
	scanf("%d",&n);
	for(int i=1;i<=cnt;i++)
	  if(prime[i]==n)
	    flag=1;
	if(flag==1) printf("1\n");
	else if(n%2==0) printf("2\n");
	else printf("3\n");
	return 0;
}


#include<stdio.h>
#include<string.h>
int main() {
    int t;
    scanf("%d", &t);
    while (t--) {
        int n, s = 0, j = 1;;
        scanf("%d", &n);
        for (int i = 9;i > 0;i--) {
            if (n >= i) {
                n -= i;
                s += (i * j);
                j *= 10;
            }
        }
        printf("%d\n", s);
    }
    return 0;


#include<stdio.h>
int main()
{
    int n,a,b,i;
    sacnf("%d %d %d", &n,&a,&b);
    i=a+1;
    printf("%d",i);
    return 0;

}


#include<stdio.h>
#include<string.h>
int main(){
    char str[101];
    scanf("%s",&str);
    int n=strlen(str);
    for(int i=0;i<n;i++){
        if(str[i]>=65&&str[i]<=90){
            str[i]=str[i]+32;
        }
    }
    for(int i=0;i<n;i++){
        if(str[i]!='a'&&str[i]!='o'&&str[i]!='e'&&str[i]!='i'&&str[i]!='u'&&str[i]!='y'){
            printf(".");
            printf("%c",str[i]);
        }
        }
    }
        return 0;
}


#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	char num[100];
	scanf("%s",num);
	char answer[100];
	int result=0,count1;
	for(int i=0;i<n-1;i++)
	{
		count=0;
		for(int j=0;j<n-1;j++)
		{
			if(num[i]==num[j]&&num[i+1]==num[j+1])
			{
				count1++;
			}
			int k=0;
			if(result<count1)
			{
				result=count1;
				answer[k]=num[i];
				k++;
				answer[k]=num[i+1];
			}
		}
	}
	for(int i=0;i<2;i++)
	{
		printf("%c",answer[i]);
	}
}


#include<stdio.h>
#include<algorithm>
int gcd(long long int n1,long long int n2)
{
return (n2!=0)?gcd(n2,n1%n2):n1;
//return findgcd(n2,n1%n2);
//else
//return n1;
}
long long lcm(long long a,long long b)
{
    return (a/gcd(a,b))*b;
}
int main()
{
long long n,a,b,p,q,ans=0;
scanf("%lld %lld %lld %lld %lld",&n,&a,&b,&p,&q);
ans+=(n/a)*p;
ans+=(n/b)*q;
ans-=(n/lcm(a,b))*(p>q?q:p);
printf("%lld\n",ans);
}


#include <stdio.h>

int main(void){
int k;
scanf("%d", k);
int cnt[10];
for (int i=0; i<10; i++)
cnt[i] = 2 * k;
char c;
while ((c = getchar()) != EOF)
if (c >= '0' && (c -= '0') <= 9)
if (!(cnt[c]--)){
printf("NO\n");
return 0;
}
printf("YES\n");
return 0;
}


#include <stdio.h>

int main()
{
    int i, set[44751], n, k;
    for(i=0; i<44750; i++)
        set[i]=(i*(i+1))/2;
    scanf("%d", &n);

    for(i=1; i<44750; i++)
    {
        if(set[i]>n)
            break;
        int j=n-set[i];
        //printf("j=%d\n", j);
        for(k=1; k<44750; k++)
        {
            //printf("set[k]=%d\n", set[k]);
            if(j==set[k])
            {
                printf("YES\n");
                return 0;
            }
            if(j<set[k])
                break;
        }
    }
    printf("NO\n");
    return 0;
}


#include<stdio.h>
int main(){
	int i,c=0,b=1,n;
	char a [55];

	scanf("%s",a);
	int n=strlen (a);

	for(i=0;i<n;i++){
	if (a [i]=='a'){
		c++;}
	}
	if (c >n/2){
		printf ("%d\n",n);}
		else if (c==1){	printf ("%d\n",c);}
		else {
			printf ("%d\n",(2*c)-1);}

	return 0;
}


#include <stdio.h>
#include <math.h>
int main() {
	int n, result = 1, s = 0;
	scanf_s("%d", &n);
	n++;
	if (n < 10)result--;
	else while (!(n % 10))
		n /= 10;
	while(n>100)
	{
		s = 10 - n % 10;
		result += s;
		n += s;
		while (!(n % 10))
			n /= 10;
	}
	printf("%d", 9 + 9*(n/10)+result);
}


#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
 int a[6],i,t,j,found=0,ans,n=0,x=0;
 printf("Enter the time:");
 scanf("%d",&t);
 for(i=1;i<=5;i++)
 {
  a[i]=i;
 }
 for(i=1;i<=t && found==0;)
 {
  x++;
  ans=a[x];
  for(j=1;j<=pow(2,n) && found==0;j++)
  {
   if(i<t)
   {
    i++;
   }
   else if(i==t)
   {
    found=1;
   }
  }
  if(i==5*pow(2,n))
  {
   n++;
   x=0;
  }
 }
 switch(ans)
 {
  case 1:
  printf("Sheldon");
  break;
  case 2:
  printf("Leonard");
  break;
  case 3:
  printf("Penny");
  break;
  case 4:
  printf("Rajesh");
  break;
  case 5:
  printf("Howard");
  break;
 }
getch();
clrscr();
}


#include<stdio.h>

int main()

{
    int k,w;
    long long int sum=0;
    long long int n;
    scanf("%d %lli %d",&k,&n,&w);
    for(int i=1;i<=w;i++ )
    {
        sum=sum+k;
    }
    if(sum>=n)
    {
        printf("%lli\n",sum-n);
    }
    else
    {
        printf("0\n")
    }
}


#include <cstdio>

int main(void)
{
    int p1,p2,p3,p4,a,b,i,cnt=0;
    scanf("%d%d%d%d%d%d",&p1,&p2,&p3,&p4,a,b);
    for(i=a;i<=b;i++)
    if(i%p1%p2%p3%p4==i)
        cnt++;
    printf("%d\n",cnt);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
	int n;
	scanf("%d", &n);

	int arr[n];
	int i,j,k;

	for(i=0;i<n;i++)
	scanf("%d", &arr[i]);

	long long int count=0;
	int right=0;

	while(right!=n)
	{
		for(j=0;j<n;j++)
		{
			for(k=0;k<n;k++)
			{
				if(arr[j]==arr[k] && j!=k && arr[j]>0)
				{
					arr[j]-=1;
				}
			}
		}

		right=0;
		for(j=0;j<n;j++)
		{
			for(k=j+1;k<n;k++)
			{
				if(arr[j]==arr[k])
				break;
			}
			if(k==n)
			right++;
		}
	}
	for(i=0;i<n;i++)
	{
		count+=arr[i];
	}

	/*for(i=0;i<n;i++)
	printf("%d ", arr[i]);
	printf("\n");*/

	printf("%lld", count);

	return 0;
}


#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cstdio>

using namespace std;
int main()
{
	long a=0,b=0;
	scanf("%ld%ld",&a,&b);
	if(a<10)
	printf("%d",a);
	else{
		long number=b-a+1;
	long c=a;
	long flag2=0;
	int d[100000]={};
	while(c<=b){
		a=c;
		long f=0;
		while(a!=0){
			if(a<10)
			d[f]=a;
			else
			d[f]=a-a/10*10;
			a=a/10;
			f++;
		}
		sort(d,d+f);
		long g1=0,flag=0;
		while(g1<=f){
			long g2=g1+1;
			while(g2<=f){
				if(d[g1]==d[g2]){
					flag++;

					break;
				}
				g2++;
			}
			g1++;
		}
		if(flag==0){
			printf("%ld\n",c);
			break;

		}else
		flag2++;

		c++;
	}
	if(flag2==number)
	printf("-1\n");
	}
	return 0;

}


#include<stdio.h>
#include<conio.h>
main()
{
     int a,b;
     scanf("%d %d",&a,&b);
     int count=0;
     while(a>0&&b>0)
     {    if(a==1&&b==1)
          break;
          }
          else if(a<3)
          {a=a+1;
          b=b-2;
          }
          else if(b<3)
          {a=a-2;
           b=b+1;

          }
          else if(a>b)
          {
               a=a+1;
               b=b-2;
          }
          else
          {
               a=a-2;
               b=b+1;
          }
          count++;
     }
     printf("%d",count);
}


#include<stdio.h>
main()
{
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%c",&a);
        if(a!='1')
           break;
    }
    if(i==n+1)
       printf("%d",n);
    else
       printf"%d",i);
}


#include <stdio.h>
long long int max,min,mid,ans,c[3],lol;
#define setmax() c[0]>c[1]?(max=0,c[2]>c[max]?max=2:1):(max=1,c[2]>c[max]?max=2:1)
#define setmin() c[0]<=c[1]?(min=0,c[2]<=c[min]?min=2:1):(min=1,c[2]<=c[min]?min=2:1)
#define setmid() (max+min)==1?mid=2:(max+min)==2?mid=1:mid=0
//#define setall() (setmax(),setmin(),setmid())
int main()
{
	scanf("%lld %lld %lld",&c[0],&c[1],&c[2]);
	setmax();
	setmin();
	setmid();
	while(1)
	{
		if((c[max]-2)>=0 && (c[mid]-1)>=0)
		{
			c[max]-=2;
			c[mid]-=1;
			ans++;
			setmax();
			setmin();
			setmid();
		}
		else if(c[0]==1 && c[1]==1 && c[2]==1)
		{
			ans++;
			break;
		}
		else break;
	}
	printf("%lld\n",ans);
	return 0;
}


#include<stdio.h>

typedef unsigned long long int uint64;
typedef unsigned char uint8;

uint8 findsum(uint64 x)
{
   uint8 sum=0;
   uint8 temp;
   while(x!=0)
   {
      temp = x%10;
      sum += temp;
      x= x/10;
   }
   return sum;
}

int main(void)
{
   uint64 x,maxnum,b=1;
   scanf("%llu",&x);
   maxnum=x;
   while(x)
   {
      uint64 cur = (x-1)*b + (b-1);
      if(findsum(cur) > findsum(maxnum))
         maxnum = cur;
      x=x/10;
      b=b*10;
   }

   printf("%llu",maxnum);
}


#include<stdio.h>
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
    for(int i=(n+1)/2;i<=n;i++)
       {
        if(i%m==0)
        printf("%d",i);
       }
    printf("-1");
    return 0;
}


#include <stdio.h>
#include <math.h>
using namespace std;

int main() {
    long long int n,ans,temp,k,v,l;
    scanf("%I64d",&n);
    if(n<=9)
    {
        printf("%I64d\n",n);
    }
    else
    {
        ans=9;
        v=9;
        l=1;
        temp=(long long int)log10(n);

        for(k=0;k<temp-1;k++)
        {
            v=v*10;
            l++;
            ans=ans+v*(l);
        }

        temp=pow(10,temp);

            ans+=(n-temp+1)*(l+1);

        printf("%I64d\n",ans);
    }
    return 0;
}


#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
#define n 6

int main() {

	int l[6], sum = 0, yes = 0;
	for(int i = 0; i < n; i++){
		scanf("%d", &l[i]);
		sum += l[i];
	}
	for(int i = 0; i < n; i++)
		for(int j = i + 1; j < n; j++)
			for(int k = j + 1; k < n; k++)
				if(sum == 2 * (l[i] + l[j] + l[k])){
					yes = 1;
				}

	if(yes) printf("YES\n");
	else printf("NO\n");

	return 0;
}


#include<stdio.h>
#include<math.h>

int sum(int n){
    int ans=0;
    while(n){
        ans+=(n%10);
        n/=10;
    }
    return ans;
}
int main()
{
    int l[10000];
    int i;
    int a,b,c,x,counter=0;
    scanf("%d %d %d",&a,&b,&c);
    for(i=1;i<100;i++){
        x = b*round(pow(i,a)) + c ;
        if(sumOfDites(x)==i&&x>0&&x<pow(10,9)){
            l[counter]=x;
            ++counter;
        }
    }
    printf("%d\n",counter);

    for(i=0;i<counter;++i){
        printf("%d ",l[i]);
    }

return 0;
}


	#include<stdio.h>
int main()
{

    int a,sum=0,q,i;
    for(i=0;i<5;i++)
    {
        scanf("%d",&a);
        sum=sum+a;
        a=0;
    }
    if(sum%5==0)
    {
        q=sum/5;
        printf("%d",q);
    }
    else
    printf("-1");
    return 0;


#include <stdio.h>

int main{
char s[20];
int a,b;
scanf("%s",&s);
a=strlen(s);
b=((a*25)+26);
printf("%d",b);
return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    int a[100];
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    int big=a[0];
    for(int i=1;i<n;i++)
    {
        if(a[i]>big)
        {
           big=a[i];
        }
    }
    int sum=0;
    for(int i=0;i<n;i++)
    {
        sum=sum+a[i];
    }
    sum=sum*2;
    int ans1;
    if(sum%n!=0)
    {
       ans1=sum/n+1;
    }
    else
    {
        ans1=sum/n;
    }
    int ans2;
    if(ans1>big)
    {
        cout<<ans1<<endl;
    }
    else
    {
        cout<<big<<endl;
    }
    return 0;
}


#include<stdio.h>
int main()
{
    int y,b,r,s;
    scanf("%d %d %d",&y,&b,&r);
    if((b>y)&&(r>b))
     {
         s=(3*y)+3);
         printf("%d",s);
     }
    return 0;
}


#include<stdio.h>
#include<math.h>
long mu10(int x){
	int i;long kq=1;
	for(i=1;i<=x;i++)kq=kq*10;
	return kq;
}
char So_xau(char s[],long n){
	int i;
	for(i=8;i>-1;i--){
		s[8-i]=n/mu10(i)+48;
		n=n%mu10(i);
	}
	s[9]=0;
}
int main(){
long a,b,mod;
char win;
char a1[10];
scanf("%ld%ld%ld",&a,&b,&mod);
if(b>=mod-1)win=2;
else{
	long A;
	if(a>=mod)A=mod-1;else A=a;
	long i,S=0;
	for(i=1;i<=A;i++){
	S=S+mu10(9)%mod;
	while(S>mod)S=S-mod;
	if(S>0&&S<mod-b)break;

	}
	if(i>A)win=2;
	else{
		win=1;
		So_xau(a1,i);
	}
}
printf("%d",win);if(win==1)printf(" %s",a1);
}


#include<stdio.h>
#include<string.h>
int main()
{
int main(){
int x,y;
scanf("%d %d",&x,&y);
if((x+y) == 3)
    else printf("Akshat");
else if((x*y)%2 == 0)
printf("Malvika");
else printf("Akshat");
return 0;

}

}


#inlude<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if(b>=a && c>=a)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
}

    }


#include <stdio.h>

int main ()
{

    int n,i,cont1,cont2;
    scanf("%d",&n);
    char numero[(n*2)+1];
    scanf("\n%s",numero);
    cont1 = 0;
    cont2 = 0;
    if( numero [1] > numero [ (n*2)-1]  &&  numero[n-1 > numero[n])
    {
        printf("YES");
        return NULL;
    }
    if( numero [1] < numero [ (n*2)-1]  &&  numero[n-1 < numero[n])
    {
        printf("YES");
        return NULL;
    }
    printf("NO");

    return NULL;
}


#include <stdlib.h>

main()
{
    int n=0,a=0,b=0,res=0;

    scanf("%d %d %d",&n,&a,&b);

    if(abs(b) >=  n)
    {
        if( b%n >= 0) {
            res = abs(a + (b%n));
        }else {
            res = abs(a + n + (b%n)) ;
        }

    } else {
        if(b >= 0)
            res =  abs(a + b));
        else
            res = abs(a + n + b);
    }
    if(res <=n )
       printf("%d",res);
    else
       printf("%d",   res - n   );

}


#include<stdio.h>
#include<stdlib.h>
int main()
{
    int *arr, n, i, j, temp;
    scanf("%d",&n);
    arr = (int*)malloc(n*sizeof(int));
    for(i = 0; i < n; i++)
   {
       scanf("%d", &arr[i]);
   }
    for(i = 0; i < (n-1); i ++)
    {
        for(j = 0; j < (n-i-1) ; j++)
        {
            if(arr[j] > arr[j+1])
           {{
               temp = arr[j];
               arr[j] = arr[j+1];
               arr[j+1] = temp;
           }
        }
    }
    for(i = 0; i < n; i++)
    printf("%d ", arr[i]);
    return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
    int i;
    char arr[201];
    scanf("%s",arr);
    int len=strlen(arr);
    for(i=0;i<len-2;i++){
        if(arr[i]=='W' && arr[i+1]=='U' && arr[i+2]=='B'){
        i=i+2;
        printf(" ");
        continue;
        }
        if(arr[i]!='W'&& arr[i+1]!='U' && arr[i+2]!='B'){
        printf("%c",arr[i]);
        }
    return 0;
}


#include<stdio.h>
#include<math.h>

int main()
{
double m,n,a;
double a1,a2;
scanf("%lf%lf%lf",&m,&n,&a);
a1=ceil(m/a);a2=ceil(n/a);
if(m%a==0)	a1=ceil(m/a-1);
if(n%a==0)	a2=ceil(n/a-1);
printf("%d",(a1+1)*(a2+1));
return 0;
}


# include <stdio.h>

using namespace std;

int main(void)
{
    int n, m;
    while(~scanf("%d%d", &n, &m))
    {
        if(n % 2 == 0)
        {
            if(m > n/2)
                printf("%d\n", (m-(n/2))*2);
            else
                printf("%d\n", 2*m-1);
        }
        else
        {
            if(m > n/2+1)
                printf("%d\n", (m-(n/2+1))*2);
            else
                printf("%d\n", 2*m-1);
        }
    }

    return 0;
}


#include <stdio.h>
#include <math.h>

int main() {
    int a;
    scanf ("%d", &a);
    printf ("%d", (factorial(a + 2 - 1)/factorial(a - 1)));
    return 0;
}


#include <stdio.h>

void SoftDrink(int n, int k, int l, int c, int d, int p, int nl, int np);

void SoftDrink(int n, int k, int l, int c, int d, int p, int nl, int np)
{
    int temp1 = 0, temp2 = 0, temp3 = 0;
    int min;
    temp1 = (k*l)/nl;
    temp2 = c*d;
    temp3 = p/np;

        min = temp1;
        if(temp2 < min)
        {
            min = temp2;
        }

        if(temp3 < min)
        {
            min = temp3;
        }

    printf("%d ", min/n);
}
int main(void)
{
    int N, int K, int L, int C, int D, int P, int NL, int NP;
    scanf("%d %d %d %d %d %d %d %d ", &N, &K, &L, &C, &D, &P, &NL, &NP);
    SoftDrink(N, K, L, C, D, P, NL, NP);
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup />
</Project>


#include <stdio.h>
#include <stdlib.h>

int main(){
char a[10],b[10];
int c,d,k;
gets(a);
gets(b);
if(strstr(a,"ond")!=NULL){c=1;}
if(strstr(a,"ues")!=NULL){c=2;}
if(strstr(a,"ednes")!=NULL){c=3;}
if(strstr(a,"hursd")!=NULL){c=4;}
if(strstr(a,"rida")!=NULL){c=5;}
if(strstr(a,"aturd")!=NULL){c=6;}
if(strstr(a,"und")!=NULL){c=7;}
if(strstr(b,"onda")!=NULL){d=1;}
if(strstr(b,"uesd")!=NULL){d=2;}
if(strstr(b,"ednesd")!=NULL){d=3;}
if(strstr(b,"hursd")!=NULL){d=4;}
if(strstr(b,"rida")!=NULL){d=5;}
if(strstr(b,"aturd")!=NULL){d=6;}
if(strstr(b,"unda")!=NULL){d=7;}
k=d-c;
if(k<0){
    k+=7;
}
if(k=0||k=2||k=3){
    printf("yes");
}
    else printf("no");
}
return 0;
}


//
//  Battle.c
//
//
//  Created by Maris Serzans on 06.08.14.
//
//

#include <stdio.h>

int main()
{
    int a;
    scanf("%i", &a);
    print("%i", a * 3 / 2);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main(){
    int N;
    scanf("%d", &N);
    char *s = (char*) malloc((N+1) * sizeof(char));
    scanf("%s", s);
    int i, len = 0, maxLen = 0, wordCount = 0, isInsideParen = 0;
    for(i = 0; i <= N; i++){
        if(s[i] == '_' || s[i] == '(' || s[i] == ')' || s[i] == 0){
            if(!isInsideParen && len > maxLen){
                maxLen = len;
            }else if(isInsideParen){
                if(len > 0)
                    wordCount+#include <stdio.h>
#include <stdlib.h>
int main(){
    int N;
    scanf("%d", &N);
    char *s = (char*) malloc((N+1) * sizeof(char));
    scanf("%s", s);
    int i, len = 0, maxLen = 0, wordCount = 0, isInsideParen = 0;
    for(i = 0; i <= N; i++){
        if(s[i] == '_' || s[i] == '(' || s[i] == ')' || s[i] == 0){
            if(!isInsideParen && len > maxLen){
                maxLen = len;
            }
            if(isInsideParen){
                if(len > 0)
                    wordCount++;
                if(s[i] == ')'){
                    isInsideParen = 0;
                }
            }
            else if(s[i] == '('){
                isInsideParen = 1;
            }
            len = 0;
        }else{
            len++;
        }
    }
    printf("%d %d\n", maxLen, wordCount);
}+;
                if(s[i] == ')'){
                    isInsideParen = 0;
                }
            }else if(s[i] == '('){
                isInsideParen = 1;
            }
            len = 0;
        }else{
            len++;
        }
    }
    printf("%d %d\n", maxLen, wordCount);
}


#include<stdio.h>
#include<string.h>

int main()
{
      void swap(int*,int*);
      int n,t;
      scanf("%d %d",&n,&t);

      char q[100];
      scanf("%s",q);

      int i,j;

      for(i=0;i<t;i++)
      {
            for(j=0;j<n;)
            {
                  if(q[j]=='B'&&q[j+1]=='G')
                  {
                        swap(q+j,q+j+1);
                        j=j+2;
                  }

                  else
                  j++;
            }

      }

      printf("%s",q);
}

void swap(char *a,char *b)
{
      char temp;
      temp=*a;
      *a=*b;
      *b=temp;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define MAX 100
int main()
{
    int i=0;
    char a[26];
    for (i=0;i<26;i++)
        a[i]=0;
    int count=0;
    int alpha;
    char str[MAX];
    gets(str);
    int l=strlen(str);

    for (i=0; i<l; i++)
    {
        if (!islower(str[i]))
        {
            printf("IGNORE HIM!");
            return 0;

        }
        alpha = (str[i]-'0')-48;
        a[alpha]=1;

        }
    for (i=0;i<26;i++)
    {

        if (a[i]==1)
        count++;
    }

int z=l-count-1;
if (z%2=0)
    printf("CHAT WITH HER!");
else
    printf("IGNORE HIM!");
return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main() {
		int n, s;
		char s[1000];
		scanf("%d", &n);
		scanf("%d", &s);
		itoa(s, s, 10);
		if (n == 1) {
			if (s[0]=='0')
			printf("No");
			else printf("Yes");
			return 0;
		}
		for (int i=1; i<n; ++i) {
			if (s[i-1]==s[i]) {
				printf("No");
				return 0;
			}
		}
		printf("Yes");
		return 0;
}


#include <stdio.h>
#include<string.h>

int main() {
    int n,a,b,i,l1,l2,x;
    char str1[12],str2[12],temp1[12],temp2[12];

    scanf("%d\n",&n);
    scanf("%d ",&a);
        //printf("%d ",a);
    for(i=0;i<a;i++)
    {
        scanf("%d",&x);
        str1[i]=x-'0';

    }
    str1[a]='\0';

    scanf("%d",&b);
    for(i=0;i<b;i++)
    {
        scanf("%d",&x);
        str2[i]=x-'0';
    }
    str2[b]='\0';
    //printf("%s %s ",str1,str2);
    strcpy(temp1,str1);
    strcpy(temp2,str2);
    //printf("%s %s ",str1,str2);
    int flag=0,count=0;
    while(1)
    {
        //printf("%s %s\n",temp1,temp2);
        if(flag)
        {
            if(!strcmp(temp1,str1)&&!strcmp(temp2,str2))
        {   printf("-1\n");
            return 0;
        }
        }
        flag=1;
        l1=strlen(temp1);
        l2=strlen(temp2);

        if(!l1)
        {

            printf("%d 2\n",count);
            return 0;
        }

        if(!l2)
        {

            printf("%d 1\n",count);
                return 0;
        }

        char one=temp1[0] ,two=temp2[0];

        for(i=0;i<l1;i++)
        temp1[i]=temp1[i+1];

        for(i=0;i<l2;i++)
        temp2[i]=temp2[i+1];

        if(one>two)
        {
            temp1[l1-1]=two;
            temp1[l1]=one;
            temp1[l1+1]='\0';
        }
        else
        {

            temp2[l2-1]=one;
            temp2[l2]=two;
            temp2[l2+1]='\0';

        }
        count++;
    }

    return 0;
}


#include <cstdio>
#include <cstdlib>

int main(int argc, char const *argv[])
{
    int n;
    int64_t sum=0;

    scanf("%d", &n);

    for(int i = 0; i < n; i++)
        sum+=n*(i+1)-i;

    printf("%ld\n", sum);

    return 0;
}


#include<stdio.h>
//using namespace std;

int main()
{
	int n , chip;
	//vector<int>v;
	scanf("%d%d",&n,&chip);
	int total = 0;
	bool mama = false;
	while(1)
	{
		int i;
		for(i = 1; i <= n;i++){
			if((chip - i ) < 0){
				mama = true;break;
			}
			else chip -= i;
		}
		if(mama)break;
	}

	printf("%d\n",chip);

	return 0;
}


#include<stdio.h>
int main()
{
    int gl,gr,bl,br,low,high,low1,high1;

    scanf("%d %d %d %d",&gl, &gr, &bl, &br);
    low = gl-1;
    high = g1*2+2;

    low1 = gr-1;
    high1 = gr*2+2;

    if((br>=low && br<=high) || (bl>=low1 && bl<=high1))
        printf("YES\n");
    else
        printf("NO\n");

}


#include<stdio.h>
void main( ){
int k,l,m;
printf("enter the weight of watermelon");
scanf("%d",&k);
printf("divide the watermelon into two parts %d %d",l,m);
scanf("%d %d",&l,&m);
if(k=l+m&&l%2=0&&m%2=0&&w%2=0){
    printf("yes");
}
else
printf("no");
}


#include<stdio.h>

int main(void) {
	int x, y;
	scanf("%d%d", &x, &y);
	y > 0 && x > y && (x - y + 1) % 2 == 0 ? cout << "YES" : cout << "NO";
	return 0;
}


#include <stdio.h>
int main() {
	int n, min, max;

	//freopen("input.txt", "r", stdin);
	scanf("%d", &n);
	if (n > 7) {
		min = n / 7 * 2;
		if (n % 7 == 0) max = min;
		else if (n % 7 == 1) max = min + 1;
		else max = min + 2;
	}
	else {
		if (n <= 5) {
			min = 0;
		}
		else if (n == 6) { min = 1; }
		else { min = 0; }
		if (n >= 2) max = 2;
		else (n == 1) max = 1;
	}
	printf("%d %d", min, max);

	return 0;
}


#include<iostream.h>
using namespace std;
int main()
{
    int n ; cin>>n;
    cout<<(n*n+(n-1)*(n-1));
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="ProblemA" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/ProblemA" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/ProblemA" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Unit filename="main.c">
			<Option compilerVar="CC" />
		</Unit>
		<Extensions>
			<code_completion />
			<debugger />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include<stdio.h>

int main()
{
    int count=0,ans=0,n,a[110],i;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        count+=a[i];
    }
    if(count!=0)
    {
        printf("YES\n1\n1 %d\n",n);
    }
    else
    {
        for(i=1;i<=n;i++)
        {
            ans+=a[i];
            if(ans!=0)
                break;
        }
        if(i==n+1)
            printf("NO\n");
        else
        {
            printf("YES\n2\n1 %d\n%d

%d\n",i,i+1,n);
        }
    }
    return 0;
}


#include <stdio.h>

int modMax = 1000000007;
long long int sumWOD[101];
long long int sumWD[101];

int n, d, k;

void computeSumWOD(int size) {
    sumWOD[0] = 1;
    sumWOD[1] = 1;
    for(int i = 2; i < size; i++) {
        for(int j = 0; j<=k && i-j>0; j++) {
            sumWOD[i] += sumWOD[i-j];
            sumWOD[i] %= modMax;
        }
    }
}

void computerSumWD(int size) {
    for(int i = 1; i < size; i++) {
        if(i >= d)
            sumWD[i] += sumWOD[i-d];
        for(int j = 1; j <=k && i-j>0; j++) {
            if(j == d)
                continue;
            sumWD[i] += sumWD[i-j];
            sumWD[i] %= modMax;
        }
    }
}

int main () {
    //get n, k, d
    int n,k,d;
    scanf("%d%d%d", &n, &k, &d);
    computerSumWOD(n+1);
    computerSumWD(n+1);
    printf("%I64d", sumWD[n]);
    return 0;
}


#include<stdio.h>
#include <algorithm>
int main(){
    int n;
    scanf("%d", &n);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d", &a[i]);
    }
    int c,maxx,minn,d,e,f,g;
    for(i=0;i<n;i++){
        if(a[i]==n)
            maxx=i;
        if(a[i]==1)
            minn=i;
    }
    c=maxx;
    d=n-maxx;
    e=minn;
    f=n-minn;
    int g[4]={c,d,e,f};
    sort(g[4]);
    g=g[0];
    if(g<n-g)
        g=n-g;
    printf("%d",g);

}


#include <stdio.h>
#include <stdlib.h>
long long int (long long int ,long long int)
{
    return a>b?a:b;
}
int main()
{
    int n;
    long long int ans;
    scanf("%d",&n);
    if(n==1)
        ans=1;
    else if(n==2)
        ans=2;
    else if (n==3)
        ans=6;
    else if(n%2==0)
        ans=max((n-1)*(n-2)*(n-3),n*(n-1)*(n-3));
    else
        ans=(n)*(n-1)*(n-2);
    printf("%lld",ans);
    return 0;
}


#include <stdio.h>

int main()
{
    int a,b,r;
    scanf("%d %d %d",&a,&b,&r);
    if (2*r>((a<b)?a:b)) printf("Second\n");
    else printf("First\n");
    system("pause");
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int cmpfunc (const void * a, const void * b)
{
   return ( *(int*)a - *(int*)b );
}
int main()
{
	int* ar=calloc(6,sizeof(int));
	int* count=calloc(10,sizeof(int));
	int* dif=calloc(2,sizeof(int));
	int i=0;
	for(i=0;i<6;i++)
	{
		scanf("%d",ar+i);
		count[ar[i]]++;
	}
	int k=0;
	int p=0;
	for(i=1;i<=9;i++)
	{
		if(count[i]==4)
			k=1;
		if(count[i]==2)
			p=1;
		if(count[i]==6)
			{k=1;p=1}
		if(count[i]==5)
			{k=1;p=0}
	}
	if(k==1 && p==1)
		printf("Elephant");
	else if(k==1)
		printf("Bear");
	else
		printf("Alien");

	return 0;

}


#include <stdio.h>
#define matchboxes 100000000

int m, containers[matchboxes][2];
int main()
{
    int n,i,result;
    scanf("%d",&n);
    scanf("%d",&m);
    for(i=0;i<m;i++)
    {
        scanf("%d",&containers[i][0]);
        scanf("%d",&containers[i][1]);
    }
    result=a(n);
    printf("%d",result);
    return 0;
}

int a(int n)
{
    int sum;
    if(n<=0)
    {
       return 0;
    }
    else
    {
        int max=0,i;
        for(i=0;i<m;i++)
        {
            if(containers[max][1]<containers[i][1])
            {
                 max=i;
            }
        }
        if(containers[max][0]>n)
            containers[max][0]=n;
        sum = (containers[max][0]*containers[max][1]);
        containers[max][1]=0;
        return sum+a(n-containers[max][0]);
    }
}


/*

A. Nineteen
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Alice likes word "nineteen" very much. She has a string s and wants the string to contain as many such words as possible. For that reason she can rearrange the letters of the string.

For example, if she has string "xiineteenppnnnewtnee", she can get string "xnineteenppnineteenw", containing (the occurrences marked) two such words. More formally, word "nineteen" occurs in the string the number of times you can read it starting from some letter of the string. Of course, you shouldn't skip letters.

Help her to find the maximum number of "nineteen"s that she can get in her string.
Input

The first line contains a non-empty string s, consisting only of lowercase English letters. The length of string s doesn't exceed 100.
Output

Print a single integer — the maximum number of "nineteen"s that she can get in her string.
Examples
Input
Copy

nniinneetteeeenn

Output
Copy

2

Input
Copy

nneteenabcnneteenabcnneteenabcnneteenabcnneteenabcii

Output
Copy

2

Input
Copy

nineteenineteen

Output
Copy

2

*/

// Code

#include <stdio.h>

int main() {

	char str[];

	gets(str);

	int iCount = 0;

	for(int i = 0; str[i] != '\0'; i++) {
		if(str[i] == 'i') iCount++;
	}

	printf("%d", iCount);

	return 0;
}


#include <stdio.h>
int main(){
	long long int k, l, i, ans = 0;
	scanf("%lld %lld", &k, &l);
	ans = k;
	for(i = 0; ; i++){
		if(ans == b){
			printf("YES\n%lld\n", i);
			return 0;
		}
		if(ans > b)
			break;
		ans =* k;
	}
	printf("NO\n");
	return 0;
}


#include<stdio.h>
int main()
{
	int a,b,k;
	scanf("%d%d%d",&k,&a,&b);
	if((a<k&&b%k)||(b<k&&a%k))
		printf("-1");
	else
	{
		if(a>k && b<k)
		      printf("%d",a/k);
		else
		{
			if(a<k && b>k)
			     printf("%d",b/k);
			else
			{
				printf("%d",a/k+b/k)
	     	 }
	    }
	}

}


#include<stdio.h>
int main(){
    int n,k;
    // int sum=0;
    int arr[3];
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        int p;
        scanf("%d",&p);
        for (int j=0;j<p;j++){
            scanf("%d",&k);
            arr[j]=k;
        }
        if(arr[p-1]==0){
            printf("NO\n");
        } else (arr[arr[p-1]]>0&&arr[arr[arr[p-1]]]>0){
            printf("YES\n");
        }
    }
    return 0;
}


#include<stdio.h>
int main()
{

int n1,n2,k1,k2;
if(n2>n1){
printf("first");
}
else if(n2==n1);
{printf("first");
}
else{
printf("second");
}

return 0;
}


#include <stdio.h>
#include <stdbool.h>

int main() {
    int T; scanf("%d\n", &T);
    for(int ti = 0, tn = T ; ti < tn ; ++ti) {
        int X; scanf("%d\n", &X); bool found = false;
        for(int i = 0 ; 7*i <= X && !found ; ++i)
             found = ((X - 7*) % 3 == 0);
        printf("%s\n", found ? "YES" : "NO");
    }
    return 0;
}


#include<stdio.h>
int main()
{
    long long int n,m,x,i,k;
    scanf("%lld %lld %lld",&n,&m,&x);
    if(x>n&&x>m&&n<=0&&m<=0)
    {
        printf("-1\n");
    }
    else
    {
        for(i=0;;i++)
        {
            if(n>=x||m>=x)
            {
                break;
            }
            else if(n<m)
            {
                n=n+m;
            }
            else
            {
                m=m+n;
            }
        }
        printf("%lld\n",i);
    }
    return 0;
}


#include<stdio.h>

int main()
    {
        int n,k,i,l=0;
        scanf("%d%d",&n,&k);
        for(i=1;i<=n;i++){
            minn+=i*5;
            if(l>240-k){
                printf("%d\n",i-1);

            }
        }

        return 0;
    }


#include <stdio.h>

using namespace std;
int m=1e9+7;
long long  pow(long long a,int n){
    long long  w=1;
    while(n>0){
        if(n%2==0){
           a=(a*a)%m;
            n/=2;
        }
        else{

 n--;
            w=(w*a)%m;
        }
    }
    return w;
}

int main(){
    int n,a=27,b=7;
    scanf("%d",&n);
    printf("%I64d",(m+pow(a,n)-pow(b,n))%m);
    return 0;
}


#include<stdio.h>

int main()
{
	int n, a, b, x, y;
	int flag = 0;
	scanf("%d %d %d %d %d", &n, &a, &x, &b, &y);
	a--;
	b--;
	x--;
	y--;
	int i = a;
	int j = b;

	for(int k=0; k<n; k++)
	{
		if (i == j)
		{
			printf("YES\n");
			return 0;
		}

		if(i == x || j == y)
			break;

		i = (i + 1)%n;

		j = (j + n -1)%n;
	}

	printf("NO\n");
	return 0;


#include <stdio.h>
#include <string.h>

int main ()
{
    int n ,m ,i=0;
    scanf("%d%d",&n,&m);
    int a[n] ;
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    int sum=1,g=0;
    for(i=0;i<n;i++)
    {
        if(g+a[i]<=m)
        {
            g+=a[i];
        }
        else
        {
            sum++;
            i--;
            g=0;
        }
    }
    printf("%d",sum);6
}


#include <stdio.h>

int main(void) {
	// your code goes here
	return 0;
}

#include <stdio.h>

int main(void) {
	// your code goes here
	int adult,child;
	int min=0,max=0,a,b,c;

	scanf("%d %d",&adult,&child);
	if(adult==0&&child==0)printf("0 0");
else if(adult==0&&child!=0)printf("Impossible");

	else if(child==0)printf("%d %d",adult,adult);

	else{
	    if(adult>=child){ min=adult;max=adult+child-1;       }
	    if(adult<child){ min=child; max=adult+child-1;        }

printf("%d %d",min,max);

	}

	return 0;
}


#include<stdio.h>
int main()
{
int n,t,b,i;
scanf("%d",&n);
for(i=0;i<500;i++)
{  b=0;
    t=i*(i+1)/2;
if(t==n)
{
    printf("YES");
    b=1;
    break;
}
if(b==0)
{
    printf("NO");
}
return 0;
}


#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <climits>
#include <algorithm>
#include<map>
using namespace std;

int contains(int m){
    int r;
    while(m > 0){
        r = m % 10;
        if(r == 7)
            return 0;
        m = m /10;
    }
    return 1;

}
int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */
    int t;
    scanf("%d",&t);
    int m,n;
    scanf("%d%d",&m,&n);
    long long int c = 0;
    while(contains(m) && contains(n)){

        n = n - t;

        c++;
        if(n <= 0){
            m = m - 1;
            if(m == -1)
                m = 23;
            n = n + 60;
        }
    }
    printf("%lld\n",c);
    return 0;
}


#include <stdio.h>

void main()
{
	int a,b,c,aux,cont=0;
	scanf("%d %d %d",&a,&b,&c);

	int i,j;
	aux = a;
	for(i=0;i<b;i++)
	{
		cont+=aux;
		aux++;
	}
	cont*=2;

	printf("%d\n",cont);

}


import java.util.Scanner;
public class v
{
    // instance variables - replace the example below with your own
    public static int main()
    {

        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int sum=0;
        for(int i=0;i<n;i++)
        {int a=sc.nextInt();
            sum=sum+a;
        }
       for(int i=0;i<n;i++)
        {
           int a=sc.nextInt();
            sum=sum-a;
        }
        if(sum>=0)
        System.out.println("Yes");
        else
        System.out.println("No");

    return 0;

    }
}


#include<bits\stdc++.h>

using namespace std;

int gcd (int a, int b)
{
	if (b == 0)
		return a;
	if (a == 0)
		return b;
	else
		return gcd (b, a % b);
}

int main()
{
	int n; cin>>n;
	int a,b;
	a = 0;
	b = 0;
	for(int i = 1; i <= n/2; i++)
	{
		if(gcd(i,n-i) == 1)
		{
			a = i;
			b = n-i;
		}
	}

	cout<<a<<" "<<b;

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(){
	long long a,b,i;
	long long t[100];
	scanf("%lld %lld",&a,&b);
	for(i=0;i<3;i++){
		scanf("%lld",&t[i]);
		if(i==0){
			a=a-2*t[i];
		}
		if(i==1){
			a=a-t[i];
			b=b-t[i];
		}
		if(i==2){
			b=b-3*t[i];
	}
}
    if(a<0){
		if(b<0){
			printf("%lld",-(a+b));
		}
		else(b>=0){
			printf("%lld",-a);
		}
	else{
		if(b<0){
			printf("%lld",-(b));
		}
		else(b>=0){
			printf("%d",0);
	return 0;}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[100];
    gets(s);
    int i,j,x,y,z=0,n,b;
    x=strlen(s);
    for(i=0; i<x; i++)
    {
        if(s[i]=='h' && s[i+1]=='e')
        {
            j=i;
            while(i<x)
            {

                if(s[i]=='o')
                {
                    n=i;
                    break;
                }

                i++;
            }
        }

    }
    for(j; j<=n; j++)
    {
        if(s[j]=='h' || s[j]=='e' || s[j]=='l' || s[j]=='o')
        {

        }
        else
        {
            z=1;
            printf("No\n");
            break;
        }

    }
    if(z==0)
    {
        printf("Yes\n");
    }
    return 0;

}


#include<stdio.h>
#include<math.h>
int main()
{
    float d,L,v1,v2;
    scanf("%d %d %d %d",&d,&L,&v1,&v2);
    printf("%f\nL-d)/(v1+v2));
return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int ans,i,j,i1,j1,r,c,n,s,a[11],b[11];
int search(int x,int y,int d1,int d2)
{
int sum,k;sum=0;
for(k=1;k<=n;k++)
{
if(a[k]>=x&&a[k]<=x+d1-1&&b[k]>=y&&b[k]<=y+d2-1)
sum++;
if(sum>=s) return 1;
}
return 0;
}

int main(int argc, char *argv[]) {
	scanf("%d%d%d%d",&r,&c,&n,&s);
	for(i=1;i<=n;i++)
	scanf("%d%d",&a[i],&b[i]);
	ans=0;
	for(i=1;i<=r;i++)
	  for(j=1;j<=c;j++)
	  {
	  for(i1=1;i1<=r-i+1;i1++)
	  for(j1=1;j1<=c-j+1;j1++)
	  if(search(i1,j1,i,j)) ans++;

	  }
	printf("%d\n",ans);
	return 0;
}


#include<stdio.h>
int main()
{
    int t;
    scanf("%d",&t);
    printf("%d",t);
}


#include<stdio.h>

int abs(int a) {
    if (n >= 0) {
        return n;
    }
    return -n;
}

char a[201];
int i,n,x,ans;
main()
{
    scanf("%d %s",&n,a);
    for(i=0;i<n;i++)if(a[i]=='X')x++;
    ans = abs(n / 2 - x);
    for(i=0;i<n;i++)
    {
        if(x>n/2&&a[i]=='X')a[i]='x',x--;
        else if(x<n/2&&a[i]=='x')a[i]='X',x++;
    }
    printf("%d\n%s",ans,a);
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    char strtab[100][20]={
        "zero",
        "one",
        "Two",
        "three",
        "four",
        "five",
        "six",
        "seven",
        "eight",
        "nine",
        "ten",
        "eleven",
        "twelve",
        "thirteen",
        "fourteen",
        "fifteen",
        "sixteen",
        "seventeen",
        "eighteen",
        "nineteen",
        "twenty",
        "twenty-one",
        "twenty-two",
        "twenty-three",
        "twenty-four",
        "twenty-five",
        "twenty-six",
        "twenty-seven",
        "twenty-eight",
        "twenty-nine",
        "thirty",
        "thirty-one",
        "thirty-two",
        "thirty-three",
        "thirty-four",
        "thirty-five",
        "thirty-six",
        "thirty-seven",
        "thirty-eight",
        "thirty-nine",
        "forty",
        "forty-one",
        "fourty-two",
        "forty-three",
        "fourty-four",
        "forty-five",
        "fourty-six",
        "forty-seven",
        "fourty-eight",
        "forty-nine",
        "fifty",
        "fifty-one",
        "fifty-two",
        "fifty-three",
        "fifty-four",
        "fifty-five",
        "fifty-six",
        "fifty-seven",
        "fifty-eight",
        "fifty-nine",
        "sixty",
        "sixty-one",
        "sixty-two",
        "sixty-three",
        "sixty-four",
        "sixty-five",
        "sixty-six",
        "sixty-seven",
        "sixty-eight",
        "sixty-nine",
        "seventy",
        "seventy-one",
        "seventy-two",
        "seventy-three",
        "seventy-four",
        "seventy-five",
        "seventy-six",
        "seventy-seven",
        "seventy-eight",
        "seventy-nine",
        "eighty",
        "eighty-one",
        "eighty-two",
        "eighty-three",
        "eighty-four",
        "eighty-five",
        "eighty-six",
        "eighty-seven",
        "eighty-eight",
        "eighty-nine",
        "ninety",
        "ninety-one",
        "ninety-two",
        "ninety-three",
        "ninety-four",
        "ninety-five",
        "ninety-six",
        "ninety-seven",
        "ninety-eight",
        "ninety-nine"

    };
    int i, j,n;
    while(scanf("%d", &n)){
        if(n>=0 && n<=99) printf("%s\n", strtab[n]);
    }
    return 0;
}


#include <stdio.h>
#include <string.h>
char s[110],a[110],b[110];
int main()
{
    scanf("%s %s",a,b);
    strcpy(s,a);
    int n=strlen(a),i,f=0;
    if(n==1)
    {
        if(b[0]-a[0]>1)
            s[0]++;
            printf("%s",s);
            return 0;
    }
    for(i=n-1;i>=0;i--)
        {
            if(a[i]!= 'z')
                {s[i]++;break;}
            s[i]='a';
        }
    }
    for(i=0;i<n;i++)
    {
        if(b[i]-s[i]>0)
        {
                f=1;
                break;
        }
    }
    if(!f)
    {
        if(b[n-1]-a[n-1]>1)
            printf("%s",s);
        else
            printf("No such string");

    }else
        printf("%s",s);
    return 0;

}


#include <stdio.h>
#include<math.h>
void compareVal(int x, int y)
{
      long double a = y * log(x);
    long double b = x * log(y);
    if (a > b)
        printf( " > ");

    else if (a < b)
        printf(" < ");

    else if (a == b)
        printf(" = ");
}
int main()
{
    long double x = 4, y = 5;

    compareVal(x, y);

    return 0;
} #include <stdio.h>
#include<math.h>
void compareVal(int x, int y)
{
      long double a = y * log(x);
    long double b = x * log(y);
    if (a > b)
        printf( " > ");

    else if (a < b)
        printf(" < ");

    else if (a == b)
        printf(" = ");
}
int main()
{
    long double x, y;
    scanf("%Lf %Lf",&x,&y);
    compareVal(x, y);

    return 0;
}


#include<iostream>
main()
{
      char a[20];
      int k,i,j,l,bar,temp,flag,var;
      scanf("%s",a);
      scanf("%d",&k);
      l=strlen(a);
      for(i=0;i<l;i++)
      a[i]=a[i]-'0';
      for(j=0;j<l;j++)
      {
        flag=0;
        for(i=j+1;i<j+1+(l>=k?k:l);i++)
         {
           if(a[i]>a[j])
          {
            var=i;
            flag=1;
          }
        }

        if(flag)
        {
          temp=a[var];
          for(bar=var-1;bar>=j;bar--)
          a[bar+1]=a[bar];
          a[j]=temp;
          k-=(var-j);
        }
      }
      for(i=0;i<l;i++)
      printf("%d",a[i]);
      printf("\n");
      scanf("%d",&j);
      return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<queue>
using namespace std;
int k,p;
long long zcy[100005];
void init()
{
    int cnt=0;
    for(int i=1;i<=100000;i++)
    {
        long long tmp=i;
        int p=i;
        while(p){
            tmp=tmp*10+p%10;
            p/=10;
        }
        zcy[++cnt]=tmp;
    }
}
int main()
{
    init();
    while(~scanf("%d%d",&k,&p))
    {
        long long sum=0;
        for(int i=1;i<=k;i++){
            sum+=zcy[i];
            sum%=p;
        }
        printf("%lld\n",sum);
    }
    return 0;
}


#include<stdio.h>
int main()
{
long long int n,s;
scanf("%I64d",&n);
if(n%2!=0)
s=(n+1)/2;
else if (n%2=0)
s=(n+1);
else
s=0;
printf("%I64d",s);
return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int power(int n, int m){
    int res = 1;
    for(int i = 1; i <= m; i++){
        res = res*n;
    }
    return res;
}

int main(){
    char *n = (char *)malloc(power(10,9)*sizeof(char));
    scanf("%s", n);
    int len = strlen(n), sum = 0;
    int val = power(2,len) - 1;
    for(int i = 0; i < len; i++){
        if (*(n+i) == '7')
        sum += power(2,len-i-1);
    }
    val = val + sum;
    printf("%d", val);
    return 0;
}


#include<stdio.h>
int main()
{
    long long int a,b,i,x=1,
    scanf("%lld%lld",&a,&b);
    for(i=a;i<=b;i++){
            x=(x*i)%10;
            }
            printf("%lld\n",x);
    retur


#include <stdio.h>
#include <string.h>
int main()
{
	long long m,t,c,z,i;
	long long a[10000];
	scanf("%lld",&m);
	t=1;
	c=1;
	while(m>t)
	{
		m-=t;
		t=t*2;
		c++;
	}
	printf("%lld",c);
	if(m!=1)
	{
		m--;
		c--;
		while(m>c)
		{
			printf(" %lld",c);
			m-=c;
			c--;
		}
		printf(" %lld",c);
	}
	printf("\n");
	return 0;
}


#include<stdio.h>
#include<math.h>
int prime_arr(int *arr)
{
  int i,j,s,c=0;
  for(i=2;i<1000;i++)
  {
    s=sqrt(i);
    for(j=2;j<=s;j++)
      if(i%j==0)
        break;
    if(j>s)
      arr[c++]=i;
  }
  return c;
}
int main()
{
  int i,j,n,k,p;
  int primes[1000];
  p=prime_arr(primes);
  scanf("%d %d",&n,&k);
  for(i=5;i<=n;i++)
  {
    for(j=2;j<p;j++)
      if(arr[i]==arr[j]+arr[j-1]+1)
        k--;
    if(!k)
      break;
  }
  if(!k)
    printf("YES");
  else
    printf("NO");
  return 0;
}


#include <cstdio>

int main() {
	int n;
	int sum;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		sum+=i>(n-i+1)?(n-i+1):i;
	}
	printf("%d",sum);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    if(n==k)
    {
        printf("0  0\n");
        return 0;
    }
   else if(n>k && n/2=k)
    {
        printf("1 %d\n",k);
    }
    else
        printf("1 %d\n",k+1);
    return 0;
}


#include <stdio.h>
int devide(int a, int b);
int main()
{
    int people, pages, notebooks, noteRed, noteGreen, noteBlue;
    scanf("%d %d", &people, &pages);
    noteRed = devide(people * 2, pages);
    noteGreen = devide(people * 5, page);
    noteBlue = devide(people * 8, pages);
    notebooks = noteRed + noteGreen + noteBlue;
    printf("%d", notebooks);
    return 0;
}
int devide(int a, int b)
{
    if(a % b == 0)
    {
        a = a / b;
    }
    else
    {
        a = a / b + 1;
    }
    return a;
}


#include<stdio.h>
main()
{
    int x,t,a,b,da,db,i,j,m,n;
    scanf("%d %d %d %d %d %d",&x,&t,&a,&b,&da,&db);
   if(x==0) {printf("YES");exit(0);}
        for(i=0;i<t;i++)
        for(j=0;j<t;j++)
        {
            m=a-(i*da)+b-(j*db);
            if(m==x) {printf("YES");exit(0);}

        }
        for(i=0;i<t;i++)
        {
            m=a-(i*da); n=b-(i*db);
            if(m==x||n==x) {printf("YES");exit(0);
        }
        printf("NO");
        return 0;
    }


#include<stdio.h>
int max(int a,int b)
{
    if(a>b)
    return a;
    else
    return b;
}
int main()
{
    int a,b,c,d;
    scanf("%d",&a);
    int arr[20]={};
    for(b=0;b<a;b++)
    scanf("%d",&arr[b]);
    int sum1=arr[0],sum2=arr[1],sum3=arr[2];
    for(b=1;b<=a/3;b++)
    {
    d=3b;
    sum1=sum1+arr[d];
    }
    for(b=1;b<=a/3;b++)
    {
        d=3b+1;
    sum2=sum2+arr[d];
    }
    for(b=1;b<=a/3;b++)
    {d=3b+2
    sum3=sum3+arr[d];
    }
    if(max(sum1,max(sum2,sum3))==sum1)
    printf("chest");
    if(max(sum1,max(sum2,sum3))==sum2)
    printf("biceps");
    if(max(sum1,max(sum2,sum3))==sum3)
    printf("back");
    return 0;

}


#include<iostream>

using namespace std;

long long mini(long long x,long long y,long long z){
	return (x<=y && x<=z)?x:((y<=x && y<=z)?y:z);
}

int main(){

	long long int a,b,c,d,e,f;long long t2,t1;
	cin>>a>>b>>c>>d>>e>>f;
	if(f>e){
		t2=mini(d,b,c);
		t1=mini(d-t2,a,100005);
	}
	else{
		t1=mini(d,a,100005);
		t2=mini(d-t1,b,c);
	}
	cout<<((t1*e)+(t2*f))<<"\n";
	return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

int verificaigual(float x[] , float y[]){
    if(x[0]==x[1] && y[0]==y[1]){
        return 0;
    }
    if(x[0]==x[2] && y[0]==y[2]){
        return 0;
    }
    if(x[1]==x[2] && y[1]==y[2]){
        return 0;
    }

    return 1;
}

int verifica(float a,float b,float  c,float d,float e,float f){
    float dist1 = sqrt((a - c)*(a - c) + (b - d)*(b - d));
    float dist2 = sqrt((c - e)*(c - e) + (d - f)*(d - f));
    float dist3 = sqrt((a - e)*(a - e) + (b - f)*(b - f));
    float u , y;

    u = dist1*dist1;
    y = (dist2*dist2 + dist3*dist3);

    if(u==y)
    {
        return 0;
    }
    u = dist2*dist2;
    y =  dist1*dist1 + dist3*dist3;

    if(u==y)
    {
        return 0;
    }
    u = dist3*dist3;
    y =(dist2*dist2 + dist1*dist1);
    if(u==y)
    {
        return 0;
    }

    return 1;
}

int main(){

    float a, b,  c, d, e, f;
    cin >> a;
    cin >> b;
    cin >> c;
    cin >> d;
    cin >> e;
    cin >> f;

    if(verifica(a,b,c,d,e,f)==0){
        cout << "RIGHT" <<endl;
        return 0;
    }

    float x[3];
    float y[3];
    x[0] = a;
    y[0] = b;
    x[1] = c;
    y[1] = d;
    x[2] = e;
    y[2] = f;

    for(int i = 0 ; i < 3 ; i ++){

        x[i] -= 1;
        if(verifica(x[0],y[0],x[1],y[1],x[2],y[2])==0 && verificaigual(x,y)){

            cout << "ALMOST"<<endl ;

            return 0 ;
        }

        x[i] += 1;
        x[i] += 1;
        if(verifica(x[0],y[0],x[1],y[1],x[2],y[2])==0 && verificaigual(x,y) ){
            cout << "ALMOST" <<endl ;
            return 0;
        }
        x[i] -=1;
        y[i] += 1;

        if(verifica(x[0],y[0],x[1],y[1],x[2],y[2])==0 && verificaigual(x,y)){
            cout << "ALMOST" <<endl;
            return 0 ;
        }
        y[i] -=1;
        y[i] -= 1;

        if(verifica(x[0],y[0],x[1],y[1],x[2],y[2])==0 && verificaigual(x,y)){
            cout << "ALMOST" <<endl;
            return 0;
        }
        y[i] +=1;

    }

    cout << "NEITHER"<<endl ;

}


#include<stdio.h>
int main()
{
	long t,k,n;
	while(~scanf("%ld%ld%ld",&n,&k,&t)){
		if(t<=k){
			printf("%ld\n",t);
		}
		else if(t<=n){
			printf("%ld\n",k);
		}
		else{
			printf("%ld\n",2*n-k-t);
		}
	}


#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,i;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }

    if(n==1)
    {
       if(a[n-1]==15)
        printf("DOWN");
       else if(a[n-1]==0)
        #include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,i;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }

    if(n==1)
    {
       if(a[n-1]==15)
        printf("DOWN");
       else if(a[n-1]==0)
            printf("UP");
       else
        printf("-1");
    }
    else if(a[n-1]>a[n-2])
    {
        if(a[n-1]==15)
        {
            printf("DOWN");

        }

        else
        printf("UP");

    }
    else if(a[n-1]<a[n-2])
    {
        if(a[n-1]==0)
            printf("UP");
        else
        printf("DOWN");

    }

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>

int main()
{
	long long lInput1;
	long long lInput2;

	int iCnt;
	long long lTotalCnt = 0;
	long long lCheck;

	long long i;

	scanf("%lld%lld",&lInput1,&lInput2);

	for( i = lInput1 ; i <= lInput2 ; i++ )
	{

		lCheck = i;
		iCnt = 0;
		while( lCheck )
		{
			if ( (lCheck & 0x1) == 0 )
				iCnt++;
			lCheck >>= 1;
		}
		if( iCnt == 1 )
			lTotalCnt++;

	}

	printf("%lld\n",lTotalCnt);

	return 0;
}


#include <stdio.h>

int main() {
	int x, y, r, a;
	scanf_s("%d",&r);
	r = r - 1;
	y = (r - 2) / 2;
	x = 0;
	while (++x) {
		if (x * (x + (2 * y) + 1) == r) {
			printf("%d %d", x, y);
			break;
		}
		else if (x * (x + (2 * y) + 1) > r) {
			puts("NO");
			break;
		}
	}
	return 0;
}


#include <iostream>

using namespace std;
int main() {
long long int n,m,z=0,p,q,r;
cin>>n;
m=n;r=n;
while(r!=0){
    r=r/10;
    z++;
}
while(1){
    n++;q=0;
    int i;p=n;
    for(i=0;i<z;i++){
        if(p%10==8){q++;}
        p=p/10;
    }
    if(q>0){break;}
}
cout<<n-m<<endl;
    return 0;
}


#include<stdio.h>
int n;
scanf("%d",&n);
int r = n % 10;
if(r != 0){
    if(r <= 5){
        n = n - r;
    }
    else{
        n = n + 10 - r;
    }
}
printf("%d",n);


#include <stdio.h>

long long int SRoot(long long int num)
{
    long long int i;

    if(num == 1)
        return 1;
    else
    {
        i = 1;
        do{
            i++;
        }while(i * i < num);

        return i;
    }
}

int main()
{
    long long int n, i, D[300]={0}, max, x, j, A[150], y, k, d;

    scanf("%lld", &n);
    for(i=0;i<n;i++)
        scanf("%lld", &D[i]);

    //Determine the maximum divisor from the array D[]
    max = D[0];
    for(i=1;i<n;i++)
        if(D[i] > max)
            max = D[i];

    x = max;

    //Determine all of the divisors of "x"
    j = 0;
    for(i=1;i<=x;i++)
        if(x % i == 0)
        {
            A[j] = i;
            j++;
        }

    //Multiply the divisors from D[] that are not present in A[];
    //thus we can get "y"
    y = 1;
    for(i=0;i<n;i++)
    {
        for(k=0;k<j;k++)
        {
            if(A[k] == D[i])
            {
                d = 1;
                break;
            }
            else
                d = 0;
        }

        if(d == 0)
            y *= D[i];
    }

    y = SRoot(long long int y);

    printf("%lld %lld", x, y);

    return 0;
}


#include<stdio.h>
#include <math.h>
int main()
{int n,x,y;
    scanf("%d %d %d",&n,&x,&y);
    x=int(ceil(float(n*y)/100))-x;
    if(x>0)
    printf("%d",x);
    else
    printf("0");
    return 0;
}


#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>

double FSimGcd(double a, double b);

int main()
{
	double x1,y1,x2,y2,x3,y3;
	double a, b, c;
	double a2, b2, c2;
	double p, q, r;
	double S, R;
	int n;

	scanf("%lf %lf", &x1, &y1);
	scanf("%lf %lf", &x2, &y2);
	scanf("%lf %lf", &x3, &y3);

	S=fabs(x1*y2+x2*y3+x3*y1-x2*y1-x3*y2-x1*y3)/2;

	a=sqrt(a2=(x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
	b=sqrt(b2=(x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
	c=sqrt(c2=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));

	p=acos((-a2+b2+c2)/2/b/c);
	q=acos((-b2+c2+a2)/2/c/a);
	r=acos((-c2+a2+b2)/2/a/b);

	R=a*b*c/4/S;

	n=(int)floor(M_PI/FSimGcd(p,FSimGcd(q,r))+0.5);

	printf("%.6f", n*R*R*sin(2*M_PI/n)/2);
}

double FSimGcd(double a, double b)
{
	if(fabs(a-b)<M_PI/1000)
	{
		return a;
	}
	else if(a>b){
		FSimGcd(a-b, b);
	}
	else{
		FSimGcd(b-a, a);
	}
}


#include<stdio.h>

int main()
{
	int sum, n, k, i, temp, flag = 0;
	int four_set, two_set, one_set;
	scanf_s("%d %d", &n, &k);
	sum = 0;
	four_set = n;
	two_set = 2 * n;
	one_set = 0;
	for (i = 0; i < k; i++) {
		scanf_s("%d", &temp);
		if (temp > 4*four_set+2*two_set+one_set) {
			flag = 1;
			break;
		}
		else {
			if (four_set * 4 >= temp) {
				four_set -= temp / 4;
				temp = temp % 4;
				if (temp == 3) {
					if (one_set > 2)
						one_set -= 3;
					else
						four_set--;
				}
				else if (temp == 2) {
					if (two_set > 0)
						two_set--;
					else if (one_set > 1)
						one_set -= 2;
					else {
						four_set--;
						one_set++;
					}
				}
				else if (temp == 1) {
					if (one_set > 0)
						one_set--;
					else {
						four_set--;
						two_set++;
					}
				}
				continue;
			}
			else {
				temp -= four_set * 4;
				four_set = 0;
				if (two_set * 2 >= temp) {
					two_set -= temp / 2;
					temp = temp % 2;
					if (temp == 1) {
						if (one_set > 0)
							one_set--;
						else
							two_set--;
					}
					continue;
				}
				else {
					temp -= two_set * 2;
					two_set = 0;
					one_set -= temp;
					continue;
				}
			}
		}
	}
	if (flag)
		printf("NO\n");
	else
		printf("YES\n");
	return 0;
}


#include<stdio.h>
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	if(a==1 && b==1)
		printf("1\n"),return 0;
	printf("%d",(b-1 >= a-b)? b-1:b+1);
	return 0;
}


/*
* @author : SRvSaha
* domino_piling.c
* 17-Jul-2016
* Description: http://codeforces.com/problemset/problem/50/A
*
*/
#include <stdio.h>
#define DOMINO_LEN 2
#define DOMINO_BREADTH 1
int main(){
    int length,breadth;
    int output;
    scanf("%d %d",&length,&breadth);
    if(length >= DOMINO_LEN && breadth >= DOMINO_BREADTH){
        if(length % DOMINO_LEN == 0){
            output = length/DOMINO_LEN * breadth/DOMINO_BREADTH;
        }
        else {
            //Case when length % DOMINO_LEN = 1. Then by rotating the domino it can
            // be placed . So using the breadth at that time.
            output = (length/DOMINO_LEN * breadth/DOMINO_BREADTH) + breadth/DOMINO_LEN;
        }
    }else {
            //Case when length < DOMINO_LEN. So only the rotated part is the answer
            output = (length/DOMINO_LEN * breadth/DOMINO_BREADTH) + breadth/DOMINO_LEN;
        }
        printf("%d\n",output);
    }
    return 0;
}


#include<stdio.h>
int main()
{
int i,n;
int a[n],key=0 ;
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<=n;i++)
{
if


#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m;
    cin>>n>>m;
    long long s=n;
    while(n>=m)
    {
        s+=n/m;
        n=n%m + n/m;
    }
    cout<<s;
}


#include <stdio.h>

typedef long long ll;

ll c[32];

ll min(ll a, ll b) {
    return a < b ? a : b;
}

ll func(ll l) {
    int i;
    ll sum = 0LL;
    for (i = 31; i >= 0; i--)
        if (l >> i & 1)
            sum += c[i];
    return sum;
}

int main(int argc, char** argv) {
    int i, n;
    ll l, ans = 0LL;

    scanf("%d%I64d", &n, &l);
    for (i = 0; i < n; i++)
        scanf("%I64d", &c[i]);

    for (i = 1; i < n; i++)
        if (2LL * c[i-1] < c[i])
            c[i] = 2LL * c[i-1];
    for (i = n; i < 32; i++)
        c[i] = 2LL * c[i-1];

    ans = func(l);
    for (;;) {
        ll lower = l & -l;
        l += lower;
        ans = min(ans, func(l));
        if (l > 2147483647LL)
            break;
    }

    printf("%I64d\n", ans);

    return 0;
}


#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int x,vec[101],i,vec2[101],j,soma,maxsoma;
	scanf("%d",&x);
	for(i=0;i<x;i++)
	{
		scanf("%d",&vec[i]);
		vec2[i]=vec[i];
	}
	soma=-1;
	maxsoma=-1;
	for(i=0;i<x;i++)
	{
		for(j=i;j<x;j++)
		{
			if(vec2[j]==1)
			{
				vec2[j]=0;
			}else
				vec2[j]=1;
		}
		for(j=0;j<x;j++)
		{
			soma=soma+vec2[j];
			vec2[j]=vec[j];
		}
		if(soma>maxsoma)
		{
			maxsoma=soma;
		}
		soma=-1;
	}
	printf("%d\n",maxsoma);
	return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="prince_escape" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/prince_escape" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/prince_escape" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Unit filename="main.c">
			<Option compilerVar="CC" />
		</Unit>
		<Extensions>
			<code_completion />
			<debugger />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);

    stack<char> s;
    vector<int> v;
    string str;
    getline(cin,str);
    int length=str.length();
    //cout<<str[2];
    for(int i=1;i<=length;i++){
        s.push(str[length-i]);
    }

    //int i=1;
    //int flag;
           while(!s.empty()){
            if(s.top()=='.'){
                v.push_back(0);

                cout<<s.top();
               // i++;

            }
            else if(s.top()=='-'){
                s.pop();
                if(s.top()=='-'){
                    v.push_back(2);
                    //s.pop();
                    //i++;
                }
                else if(s.top()=='.'){
                    v.push_back(1);
                    //s.pop();
                    //i++;
                }
            }
        s.pop();
        }
        //reverse(v.begin(),v.end());
        for(int i:v){
                cout<<i;
        }

return 0;
}


/*
    Tardes de Coding Sesión 3
    B - Friends
    A01208964 - Doménica Rentería
*/

#include <stdio.h>

#define amigos 5

int main(){

int arr[amigos] = {};
int m, a, b;
// m -> # de relaciones entre los 5 amixes
// (a, b) relacion
// a -> persona 1
// b -> persona 2

scanf("%i", &m);

int i=0;

// con este do-while, vamos a contar el numero de relaciones por persona
// con base a su número, si sale, se le suma al arreglo en su posición

do {
	scanf("%i %i", &a, &b);
    arr[a-1]++;
    //printf("arr[%i-1]++ %i\n", a, arr[a-1]++);
    arr[b-1]++;
    //printf("arr[%i-1]++ %i\n", b, arr[b-1]++);
	i++;
} while (i < m);

i=0;

// en este do-while checamos todo el arreglo
// si alguno tiene un valor diferente

do {
	if(arr[i] != 2){
    	printf("WIN\n");
    	return 0;
    }
	i++;
} while (i < amigos);

printf("FAIL\n");

return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int f=1,g=2;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        int x;
        scanf("%d",&x);
        if(x==f)
        {
           g=6-f-g;
        }
        else if(x==g)
        {
            f=6-f-g;
        }
        else
        {
            printf("NO");
            return 0;
        }
    }
    printf("YES");
}


#include <stdio.h>

int main()
{
    int n,i,j;
    int w=0;
    int count=0;

int tab1[2000];
int tab2[2000];
int r;
scanf("%d",&n);

for(i=0;i<n;i++)
{
    scanf("%d",&tab1[i]);

}

for(i=0;i<n;i++)
{
    scanf("%d",&tab2[i]);

}

for(i=0;i<n;i++)
{   for(i=j;j<n;j++)
    r=tab1[i]^tab2[j];
    w=0;
        while(tab1[i]!=r && tab1[i]!=r && w<n)
            w++
    if(w<n)
        cont ++

}
if(count%2==0
    printf("Karen"))
    else
    printf(Koyomi)

 return 0;
}


#include<stdio.h>
int main()
{
  long long int i,j,k,l,m,n;
  scanf("%I64d%I64d%I64d%I64d%I64d",&i,&j,&m,&n,&k);
  if(n<i)
  {
 printf("0\n");
  }
  else
  {
  if(m<i&&n<j)
  l=n-i+1;

  else if(n>=j)
  {
  l=j-m;

  }
  else
  {
  l=n-m;
  }
  if(i<=m)
  {l=l+1;}

  if(l>0)
  {
    if(k<=j&&k>=m&&k=>i)
    l=l-1;

  }
  printf("%I64d\n",l);
  }
  return 0;

}

//if(m<i)
 // l=n-i;
  //else


#include<stdio.h>
#include<string.h>
#include<math.h>

int MinX(int a,int b)
{
	return a = a>b?b:a;
}

int main()
{
	int i,j,k,flag1,flag2;
	char data[13][3]={"C","C#","D","D#","E","F","F#","G","G#","A","B","H"};
	char X[3],Y[3],Z[3];
	int index1,index2,len1,len2,len3,len4,len5,len6,op1,op2,op3;
	while(scanf("%s%s%s",X,Y,Z)!=EOF)
	{
		for(i=0;i<12;i++)
		{
			if(!strcmp(data[i],X))
			{
				op1 = i;
				break;
			}
		}
		index1 = 0;index2 = 0;
		flag1 = 0; flag2  = 0;
		while(1)
		{
			if(index1 == 12)
				index1 = 0;
			if(index2 == 12)
				index2 = 0;
			if(!strcmp(data[index1],Y))
			{
				op2 = index1;
				flag1 = 1;
			}
			else
				index1++;
			if(!strcmp(data[index2],Z))
			{
				op3 = index2;
				flag2 = 1;
			}
			else
				index2++;
			if(flag1 && flag2)
				break;

		}
		len1 = MinX(abs(op1 - op2),abs(12-(op1+op2))+2);
		len2 = MinX(abs(op2 - op3),abs(12-(op2+op3))+2);
		len3 = MinX(abs(op2 - op1),abs(12-(op1+op2))+2);
		len4 = MinX(abs(op1 - op3),abs(12-(op1+op3))+2);
		len5 = MinX(abs(op2 - op3),abs(12-(op2+op3))+2);
		len6 = MinX(abs(op3 - op1),abs(12-(op1+op3))+2);
		if( (len1 ==4 && len2 == 3) || (len3 ==4 && len4 ==4) || (len5 ==4 && len6 == 3))
			printf("major\n");
		else if( (len1 ==3 && len2 == 4) || (len3 ==3 && len4 ==4) || (len5 ==3 && len6 == 4) )
			printf("minor\n");
		else
			printf("strange\n");
	}
	return 0;
}


#include <stdio.h>
#include <conio.h>
#include <math.h>

int main()
{
    int x, y, n, i;
    double min = 9999999, c, tmpmin;
    int p, a, b;
    scanf("%d %d %d", &x, &y,&n);
    for (i = 1; i <= n; i++)
    {
        c = x*i / (y*1.0);
        p = floor(c+0.499999999);
        tmpmin = fabs((x*1.0) / y - (p*1.0) / i);
        if (min > tmpmin)
        {
            min = tmpmin;
            a = p;
            b = i;
        }
    }
    printf("%d/%d", a, b);
    _getch();
    return 0;


#include<stdio.h>
#include<string.h>

#define MOD 1000003

long long int mod(long long int p, long long int m)
{
	if(p==0)
		return 1;
	else if(p==1)
		return 2;
	else if(p%2)
		return (mod(1,m)*mod(p-1,m))%MOD;
	else
		return (mod(p/2,m)*mod(p/2,m))%MOD;
}

int main()
{
	char p[100],s[100];
	scanf("%s",p);

	for(long long int i=0;p[i]!='\0';i++)
	{
		if(p[i]=='>')
		{
			strcat(s,"1000");

		}
		else if(p[i]=='<')
		{
			strcat(s,"1001");
		}
		else if(p[i]=='+')
		{
			strcat(s,"1010");
		}
		else if(p[i]=='-')
		{
			strcat(s,"1011");
		}
		else if(p[i]=='.')
		{
			strcat(s,"1100")
		}
		else if(p[i]==',')
		{
			strcat(s,"1101");
		}
		else if(p[i]=='[')
		{
			strcat(s,"1110");
			//puts(s);
		}
		else
		{
			strcat(s,"1111");
			//puts(s);
		}
	}

	long long int ans=0,flag=0;
	for(long long int i=strlen(s)-1;i>=0;i--)
	{
		long long int temp=0;
		if(s[i]=='1')
			temp = mod(flag,MOD);
		ans = (ans+temp)%MOD;
		flag++;
	}
	printf("%lld\n", ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    scanf("%d",&n);
    char s[110];
    scanf("%s",&s);
    int ans1=0,ans0=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='0')
        {
            ans0++;
        }
        else
        {
            ans1++;
        }
    }
    if(ans1)
    {
        printf("1");
    }
    for(int i=0;i<ans0;i++)
    {
        printf("0");
    }
    printf("\n");
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

int n;
int a[100], b[100];
int x, k, l;

int main (int argc, char *argv[])
{
    int i;
    scanf ("%d", &n);
    for (i = 0; i < n; i++)
        scanf ("%d ", &a[i]);
    for (i = 0; i < n; i++)
        scanf ("%d ", &b[i]);
    for (i = 0; i < n; i++)
    {
        if (a[i] > b[i])
            k++;
        if (a[i] < b[i])
            l++;
    }
    if (k != 0)
        x = l / k + 1;
    else
        x = -1;
    printf ("%d", x);
    exit (EXIT_FAILURE);
}


#include <stdio.h>

int main()
{
	long long int n,k,ans,dip,deg,lul;
	scanf("%lld %lld",&n,&k);
	ans=0;
	for(long long int i=(n/2); i>=0; i--)
	{
		if(i%(k+1)==0)
		{
			ans=i/(k+1);
			break;
		}
	}
	deg=ans;
	dip=k*ans;
	lul=n-(deg+dip);

	printf("%lld %lld %lld",deg,dip,lul);
}


#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    int zero=0,one=1;
    int i=0;
    char string[n];
    while(i<n){
        scanf("%c",&string[i]);
        if(string[i]-'0'==0)
            zero++;
        else
            one++;
        i=i+1;
    }
    if(zero!=one)
    {
        printf("1\n");
        printf("%s",string);
    }
    else if((n/2)%2==0)
    {
        printf("2\n");
        printf("%c ",string[0]);
        int i=1;
        while(i<n)
        {
            printf("%c",string[i]);
            i=i+1;
        }
    }
    else if((n/2)%2==1)
    {
        int i=0;
        printf("2\n");
        while(i<=n/2)
        {
              printf("%c",string[i]);
              i=i+1;
        }
        printf(" ");
        while(i<=n)
        {
              printf("%c",string[i]);
              i=i+1;
        }
    }
return 0;
}
→Judgement Protocol
Test: #1, time: 1000 ms., memory: 0 KB, exit code: -1, checker exit code: 0, verdict: TIME_LIMIT_EXCEEDED
Input
1
1
close


#include <stdio.h>

int gcd(int m, int n)
{
    int r;
    while ((r = m % n) != 0)
    {
        m = n;
        n = r;
    }
    return n;
}

int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &n);
    while (true)
    {
        n -= gcd(a, n);
        if (n == 0)
        {
            printf("0");
            break;
        }
        n -= gcd(b, n);
        if (n == 0)
        {
            printf("1");
            break;
        }
    }
    return 0;
}


#include <stdio.h>

int main(void) {
    int x, ans;

    scanf("%d", &x);

    switch (x) {
    case 1:
        ans = 1;    // ok
        break;
    case 2:
        ans = 0;
        break;
    case 3:
        ans = 0;    // ok
        break;
    case 4:
        ans = 0;
        break;
    case 5:
        ans = 0;
        break;
    case 6:
        ans = 0;
        break;
    case 7:
        ans = 0;    // ok
        break;
    case 8:
        ans = 0;
        break;
    case 9:
        ans = 0;
        break;
    case 10:
        ans = 0;
        break;
    case 11:
        ans = 1;
        break;
    case 12:
        ans = 1;
        break;
    case 13:
        ans = 1;    // ok
        break;
    case 14:
        ans = 0;
        break;
    case 15:
        ans = 0;
        break;
    case 16:
        ans = 0;
        break;
    }

    printf("%d\n", ans);

    return 0;
}


#include<stdio.h>
main()
{
	int l, d, i;
	scanf("%d%d", &l, &d);
	if (l == 1)
		printf("%d\n", d < 10 ? d : -1);
	else
	{
		printf("%d", d<10?d:1;
		for (i = 1; i < l; i++)
			printf("0");
		printf("\n");
	}
}


#include <stdio.h>
#include <math.h>
int main()
{
    int n,l,r,min=0,max=1,dif=1,x=0;
    scanf("%d %d %d",&n,&l,&r);
   y:{ dif=1;
        for(;x<n-1;x++)
    {
        if(dif<=r){
            max+=pow(2,dif);
            dif++;
        }
        else
        if(dif==1)max+=2;
        goto y;
    }
   }
    dif=1;
    for(x=0;x<n;x++)
    {
        if(dif<l){
            min+=pow(2,dif);
            dif++;
        }
        else
        min+=1;
    }
    printf("%d %d",min,max);
}


#include<stdio.h>
#include<string.h>
int main()
{
 int l,i,j,k;
 char s[55];
 scanf("%s",s);
 l=strlen(s);
 k=l;
 if(l%2==0)
 l=(l/2)-1;
 else
 l=l/2;
 int c;
 c=l;
 printf("%c",s[l]);
 while(1)
{


#include <stdio.h>

typedef long long Long;

int main() {
    int a,c;
    scanf("%d%d",&a,&c);
    int arr[100] = {0}; int cnt = 0;
    while (a > 0 || c > 0) {
        int ta = a % 3;
        int tc = c % 3;
        a /= 3;
        c /= 3;
        arr[cnt ++] = (tc - ta + 9) % 3;
    }
    Long ans = 0;
    for (int i = cnt - 1; i > -1; i--) {
        ans = ans * 3 + arr[i];
    }
    printf("%lld\n",ans);
    return 0;
}


#include<stdio.h>
int main()
{
int n,s,k;
scanf("%d%I64d%d",&n,&s,&k);
if (s%n==0)
 {
 k==s/n
 printf("%d",k);
 }
else
 {
  k==s/n+1
 printf("%d",k);
 {
}


#include<stdio.h>
int main()
{
          int n,i,j,t;
          scanf("%d",&n);
          int a[n];
          for(i=1;i<=n;i++)
          {
                    for(j=1;j,<=n-i;j++)
                    {
                              if(a[j]>a[j+1])
                              {
                                        t=a[j];
                                        a[j]=a[j+1];
                                        a[j+1]=t;
                              }
                    }
          }
          int count=1;
          for(i=1;i<=n;i++)
          {
                    if(a[i]+1==a[i+1])
                    count++;
                    else
                    count=1;
                    if(count==3)
                    {
                              printf("YES");
                              break;
                    }
          }
          if(count<3)
          printf("NO");
          return 0;
}


#include <stdio.h>
int lcm (int a, int b);

int lcm ( int a, int b ) { int x=n1, y=n2; while ( n1!= n2 ) { if (n1>n2) n1=n1-n2; else n2=n2-n1; } return x*y/n1; }

int main()
{
	int n, m, z, i, count = 0;
	scanf ("%d%d%d", &n, &m, &z);
	printf("%d\n", z/lcm(n,m));
	return 0;
}


#include<stdio.h>
main()
{
	int n,i,sum=0,c=0,k;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		k=(i*i+i1)/2;
		sum=sum+k;
		if(sum<=n)
		c++;
	}
	printf("%d",c);
}


#include<stdio.h>
#include<math.h>

int main() {
   long long int n,m,ans;
   scanf("%lld %lld",&n,&m);
   if(n>=27)
   printf("%lld",m);
   else
   ans=pow(2,n)%m;
   printf("%lld",ans);

}


#include<stdio.h>
int main()
{
long  int n;
scanf("%I64d",&n)
if(n%2==0&&n!=0)
printf("%I64d",n+1);
else
printf("%I64d",(n+1)/2);
}


#include<stdio.h>
#include<string.h>
#define in(n) scanf("%d",&n)
#define ins(n) scanf("%s",n)

int main()
{
   {int n,m,a,b,c=0;in(n);in(m);
    int max=n>m?n:m;
    for(a=0;a<=max;a++)for(b=0;b<=max;b++){if((a*a+b)==n&&(a+b*b)==m)c++;}

    printf("%d\n",c);

return 0;}


#include<stdio.h>
int  main(){
    int i,n,prev=0,max=0;
    char s[100];
    gets(s);
    n=strlen(s);
    for(i=0;i<n;i++){
    if(s[i]='A' ||s[i]='E' ||s[i]='I' ||s[i]='O' ||s[i]='U's[i]='Y'){
    if(i-prev>max){
    prev=i-max;
    prev=i;}}}

    printf("%d",&max);
}


#include "stdio.h"
#include "string.h"

int main()
{
	char s[100];
	while (scanf_s("%s",&s)!= EOF)
	{
		int length = strlen(s);
		for (int i = 0; i < length; i++)
		{
			if (s[i] == 49)
			{
				int zeronum = 0;
				for (int j = i + 1; j < length; j++)
				{
					if (s[j] == 48)
						zeronum++;
				}
				if (zeronum >= 6)
				{
					printf("YES\n");
					break;
				}
				else
				{
					printf("NO\n");
					break;
				}
			}
		}
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
int a[18];
int n;
bool flag;
void dfs(int sum, int step)
{
    if (flag || step>n)
		return ;
    if (step==n && (sum==0||sum%360==0))
	{
        flag=true;
        return ;
    }
    dfs(sum+a[step],step+1);
    dfs(sum-a[step],step+1);
}
int main()
{
    while (scanf("%d",&n)!= EOF)
	{
		int i;
        for (i=0;i<n;i++)
            scanf("%d",&a[i]);
        flag=false;
        dfs(0,0);
        if (flag)
			printf("YES\n");
        else
			printf("NO\n");
    }
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
int n,i,j;
scanf("%d",&n);
char t[n+1][3]; char mdp[3]; char *ch;

scanf("%s",mdp);

for(i=0;i<n;i++)
{
    scanf("%s",t[i]); }

int test=0;
for(i=0;i<n;i++)
{
ch[0]='\0';
strcat(ch,t[i]);

for(j=0;j<n;j++)
{   strcpy(ch,t[i]);
    strcat(ch,t[j]);}

if(verif(ch)==1) test=1;

}
if (test==1)
printf("YES");
else printf("NO");
return 0;
}


#include<stdio.h>
using namespace std;
int x,a,b;
void dfs(int n) {
	for(int i=n;;) {
		if(i/n>=x)break;
		if(i*n>x) {
			a=i;
			b=n;
			return;
		}
		i+=n;
	}
}
int main()
{
	scanf("%d",&x);
	for(int i=1;i<=x;i++)
		dfs(i);
	if(a==0 && b==0)printf("-1");
	else printf("%d %d",a,b);
	return 0;
}


#include<stdio.h>
int main()
{
    int i,j,k,sum=0;
    scanf("%d %d",&i,&j);
    while(1)
    {
        k=i/j;
        l=k+(i%j);
        i=l;
        sum=sum+i+k;
        if(k==0)
        break;
    }
    printf("%d",sum);
    return 0;
}


#include <stdio.h>

struct {
	char valor, naipe;
	valor = naipe = 0;
} card ;

int main(){
	struct card* primeira, segunda;
	char trunfo, c;
	primeira = malloc (sizeof (struct card));
	segunda = malloc (sizeof (struct card));
	scanf ("%c", &trunfo);
	scanf ("%c", &c);
	scanf ("%c", &c);
	primeira->valor = c;
	scanf ("%c", &c);
	primeira->naipe = c;
	scanf ("%c", &c);
	segunda->valor = c;
	scanf ("%c", &c);
	segunda->valor = c;
	if (primeira->naipe == trunfo){
		if (segunda->naipe != trunfo)
			printf ("YES");
		else {
			if (primeira->valor > segunda->valor)
				printf ("YES");
			else
				printf ("NO");
		}

	}
	else {
		if (segunda->naipe == trunfo)
			printf ("NO");
		else {
			if (primeira->valor > segunda->valor)
				printf ("YES");
			else
				printf ("NO");
		}
	}
return 0;
}


#include<cstdio>
using namespace std;
int x,y;
int main(){
    scanf("%d%d",&x,&y);
    pritnf("%d\n",x+y);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>

int deco(int x){
  int a = x;
  int n=0;
  while(a>=10){
    n+= a%10;
    a = a/10;
  }
  n+=a%10;
  return n;
}

int main(){
  long int a;
  scanf("%ld",&a);
  long int max=0;
  long int x,y;
  long int b,d;
  for(long int c = 1;c<(a/2)+1;c++){
    x = deco(c);
    y = deco(a-c);
    if(x+y > max){
	  max = x+y;
	  b =c;
	  d =a-c;
	}
  }
  printf("%ld",max);
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int n,m,k,d=0,r=0,i;
   //printf("Give number columns and rows ");
    scanf("%d %d",&n,&m);
   // printf("Give number of seat:");
    scanf("%d",&k);
    for (i=2;i<=2*n*m;i+=2)
    {
        if (k<=i)
        {
          d++;
        }
    }
   // for (i=2*m;i<=2*n*m;i+=2*m)
    //{
      //  if (k>=i)
       // {
       //     r++;
       // }
  //  }
    if (k%2)
        printf("%d %d L",(int)ceil(d/n),(d%n)+1);
    else
        printf("%d %d R",(int)ceil(d/n),(d%n)+1;
    return 0;
}


#include<stdio.h>
int main(){
	char a,b,c,d;
	scanf("%c%c\n",&a,&b)
	int i,f;
	f=0;
	for(i=0;i<5;i++){
	scanf("%c%c ",&c,&d);
	if(a==c||b==d){
		f=1
	}
	}
	if(f==1){
	printf("YES");
	}
	else{
	printf("NO")
	}
	return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void main()
{
    int n,b, result;
    scanf("%d", &n);

    result = 0;
    int c = 2
    while(c <= n)
    {
        b = 1
        while(b <= sqrt(c*c/2))
        {
            if(sqrt(c*c - b*b) == (int)sqrt(c*c - b*b))
                result++;
            b++;
        }
        c++;
    }

    printf("%d", result);
}


#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{ int n;

    scanf("%d",n);
    t=(1-6^n)/(1-6);
    printf("%d",t);
    return 0;
}
S = premier terme * (1-q^nb de termes)/1-q