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

typedef struct point
{
    float x;
    float y
}
point_tp;

float p_mult(point_tp a, point_tp b) {
    return a.x * b.x + a.y * b.y;
}

point_tp p_minus(point_tp a, point_tp b) {
    point_tp res;
    res.x = a.x - b.x;
    res.y = a.y - b.y;
    return res;
}

int is_int(float x) {
    return abs(x - round(x)) < 0.000001;
}
int main(int argc, char **argv)
{
    point_tp a, b, c;
    float fi1, fi2, fi3;
    float ratio;
    assert(scanf("%f%f", &a.x, &a.y) == 2);
    assert(scanf("%f%f", &b.x, &b.y) == 2);
    assert(scanf("%f%f", &c.x, &c.y) == 2);

    fi1 = acos(p_mult(p_minus(b, a), p_minus(c, a))/sqrt(p_mult(p_minus(b, a), p_minus(b, a)) * p_mult(p_minus(c, a), p_minus(c, a))));
    fi2 = acos(p_mult(p_minus(a, b), p_minus(c, b))/sqrt(p_mult(p_minus(a, b), p_minus(a, b)) * p_mult(p_minus(c, b), p_minus(c, b))));
    fi3 = M_PI - fi1 - fi2;

    int i = 3;
    for (; i < 101; i++) {
        if (is_int(fi1/(M_PI/i)) & is_int(fi2/(M_PI/i)) & is_int(fi3/(M_PI/i))) break;
    }
    float R = sqrt(p_mult(p_minus(c, b), p_minus(c, b)))/(2 * sin(fi1));
    float S = i * R * R * sin(M_PI * 2/i)/2;

    printf("%f", S);

    --scanf("%f", &fi1);
    return 0;

}


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#define PI acos(-1)
#define EPS 1e-6

int cmp(const void *a, const void *b) {
  double da = *(double*)a;
  double db = *(double*)b;
  if (fabs(da-db)<EPS) return 0;
  if (da-db>EPS) return 1;
  return -1;
}

int istime(double x, double y) {
  double n = (floor)(x/y+EPS);
  printf ("%lf\n", fags(x-y*n));
  return 0;
  if (fabs(x-y*n)<=EPS) return 1;
  else return 0;
}

double dis(double x[2], double y[2]) {
  return sqrt((x[0]-y[0])*(x[0]-y[0]) + (x[1]-y[1])*(x[1]-y[1]));
}

double area(double x[2], double y[2], double z[2]) {
  return fabs(
      (x[0]*y[1]+z[0]*x[1]+y[0]*z[1] - z[0]*y[1]-x[0]*z[1]-y[0]*x[1])/2
      );
}

double min(double x, double y) {
  if (x - y > EPS) return y;
  else return x;
}

int main() {
  double x[2], y[2], z[2], m[2];
  double xy,xz,yz;
  double p, q, l1, l2, l3;
  double s, d, cosd;
  double mx, my, mz;
  double da[3], t;
  while (scanf ("%lf%lf", &x[0], &x[1]) != EOF) {
    scanf ("%lf%lf", &y[0], &y[1]);
    scanf ("%lf%lf", &z[0], &z[1]);
    xy = dis(x,y); xz = dis(x,z); yz = dis(y,z);
    p = (xy*xy+xz*xz+yz*yz) / 2;
    q = 1/(1/(p-xy*xy)+1/(p-xz*xz)+1/(p-yz*yz));
    l1 = q/(p-xy*xy);
    l2 = q/(p-xz*xz);
    l3 = q/(p-yz*yz);
    m[0] = (1-l1)/2*z[0]+(1-l2)/2*y[0]+(1-l3)/2*x[0];
    m[1] = (1-l1)/2*z[1]+(1-l2)/2*y[1]+(1-l3)/2*x[1];
    mx = dis(m, x); my = dis(m, y); mz = dis(m, z);

    cosd = (mx*mx+my*my-xy*xy) / (2*mx*my);
    da[0] = acos(cosd);
    cosd = (mx*mx+mz*mz-xz*xz) / (2*mx*mz);
    da[1] = acos(cosd);
    cosd = (my*my+mz*mz-yz*yz) / (2*my*mz);
    da[2] = acos(cosd);

    qsort(da, 3, sizeof(double), cmp);
    d = da[0];
    istime(da[2],d); continue;
    t = 2;
    while (! (istime(da[0],d) && istime(da[1],d) && istime(da[2],d))) {
      d = da[2]/t;
      if(istime(da[0],d) && istime(da[1],d) && istime(da[2],d))
        break;
      d = da[1]/t;
      if(istime(da[0],d) && istime(da[1],d) && istime(da[2],d))
        break;
      d = da[0]/t;
      if(istime(da[0],d) && istime(da[1],d) && istime(da[2],d))
        break;
      t++;
    }
    s = mx*my*0.5*sin(d);
    printf ("%lf\n", PI/d*2*s);

  }
  return 0;
}


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

int main(){
    int n,menor=0,mayor=0;
    int tam,i,l=1;

    scanf("%d",&n);

    int d1[n];int d2[n];

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

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

    quicksort(d1,0,n-1);
    quicksort(d2,0,n-1);

    for(i=0;i<n;i++)
    {
        if(d1[i]>d2[i])
            mayor++;
        else if(d1[i]<d2[i])
            menor++;
    }

   if(mayor==n || menor==n)
    puts("YES");
   else
    puts("NO");

    return 0;
}

void quicksort(int a[],int primero,int ultimo)
{
    int i,j,central;
    double pivote;
    int aux;

    entral=(primero+ultimo)/2;
    pivote=a[central];
    i=primero;
    j=ultimo;

    do{
    while(a[i]<pivote) i++;
    while(a[j]>pivote) j--;
    if (i<=j){
        aux = a[i];
        a[i] = a[j];
        a[j] = aux;
        i++;
        j--;
    }
}while(i<=j);
    if(j>primero)
        quicksort(a,primero,j);
    if(i<ultimo)
        quicksort(a,i,ultimo);
}


#include<stdio.h>
#include<string.h>
int main(){
    int n,i,j,c,bandera=0,bandera2=0,aux,bandera3=0;
    scanf("%d",&n);
    char num[2*n];
    scanf("%s",&num);
    c=n;
    //ordenamos la primera mitad
    for(i=0; i<n-1; i++){
        for (j=i+1; j<n; j++){
            if(num[i]>num[j]){
                aux=num[j];
                num[j]=num[i];
                num[i]=aux;
            }
        }
    }
    //ordenamos la segunda mitad
    for(i=n; i<(2*n)-1; i++){
        for (j=i+1; j<(2*n); j++){
            if(num[i]>num[j]){
                aux=num[j];
                num[j]=num[i];
                num[i]=aux;
            }
        }
    }
    //vemos si son iguales
    for(i=0; i<n; i++){
        if(num[i]==num[c]){
            bandera3=1;
            break;
        }else{
            bandera3=0;
        }
        c++;
    }
    if(bandera3==1){
        printf("NO");
    }else{
        //vemos si es menor
        for(i=0; i<n; i++){
            if(num[i]<num[c]){
                bandera=1;
                j=(2*n);
            }else{
                bandera=0;
            }
            c++;
        }
        if(bandera==1){
            printf("YES");
        }else{//si no cumple el primer criterio
            c=n;
            //vemos si es mayor
            for(i=0; i<n; i++){
                if(num[i]>num[c]){
                    bandera2=1;
                }else{
                    bandera2=0;
                    i=n;
                }
                c++;
            }
            if(bandera2==1){
                printf("YES");
            }else{
                printf("NO pito");
            }
        }

    return 0;
}


#include <stdio.h>

int main()
{
	char A[201];
	int n, i, j;

	scanf("%d", &n);
	getchar();
	for (i = 0; i < 2 * n; i++)
		scanf("%c", &A[i]);

	for (i = 0; i < n - 1; i++)
		for (j = i + 1; j < n; j++)
			if (A[i] > A[j])
			{
				char temp = A[i];
				A[i] = A[j];
				A[j] = temp;
			}

	for (i = n; i < 2 * n - 1; i++)
		for (j = i + 1; j < 2 * n; j++)
			if (A[i] < A[j])
			{
				char temp = A[i];
				A[i] = A[j];
				A[j] = temp;
			}
	int check = 1;

	for (i = 0; i < n; i++)
	{
		if (A[i] >= A[2 * n - i - 1])
		{
			check = 0;
			break;
		}
	}

	if (check)
	{
		printf("YES");
		return 0;
	}

	check = 1;

	for (i = 0; i < n; i++)
	{
		if (A[i] =< A[2 * n - i - 1])
		{
			check = 0;
			break;
		}
	}

	if (check)
		printf("YES");
	else
		printf("NO");
	return 0;
}


#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main()
{
    size_t n;
    string s, l, r;
    cin >> n >> s;
    l = s.substr(0, n);
    r = s.substr(n, n);
    sort(l.begin(), l.end());
    sort(r.begin(), r.end());
    bool strictly_less(true), strictly_more(true);
    for (size_t i = 0; i < n; ++i)
    {
        if (l[i] >= r[i])
        {
            strictly_less = false;
            break;
        }
    }
    for (size_t i = 0; i < n; ++i)
    {
        if (l[i] <= r[i])
        {
            strictly_more = false;
            break;
        }
    }
    cout << ((strictly_less || strictly_more) ? "YES" : "NO") << endl;
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	int n, c, p;
	int b[26] = {0,0 };
	char a[101];
	scanf("%d%d", &n, &c);
	getchar();
	gets(a);
	for (int i = 0; i < strlen(a); i++)
	{
		p = a[i] - 97;

		b[p]++;
	}

	for (int i = 0; i < 26; i++)
	{
		if (b[i] >=k+1)
		{
			printf("NO");
			return 0;
		}
	}
	printf("YES");
	return 0;
}


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

int main()
{
  int n,k,i,j,count=0,tem,min=0;
  char s[1000];

  scanf("%d %d",&n,&k);
  scanf("%s",s);

  for(i=0;i<strlen(s);i++)
  {
      for(j=i+1;j<strlen(s);j++)
      {
          if(s[i]>s[j])
          {
              tem=s[i];
              s[i]=s[j];
              s[j]=tem;
          }
      }

  }

  for(i=0;i<strlen(s);i++)
  {
      count=0;
      for(j=i;j<strlen(s);j++)
      {
          if(s[i]==s[j])
          {

            count++;

          }
          else
          {
              if(min>count)
              {
                  min=count;

              }
          }
      }
  }
  if(min=>k)
  {
      printf("NO");
  }
  else
  {
      printf("YES");
  }
  return 0;

}


#include<stdio.h>
#include<strng.h>
char s[201];
int a[26];
int main()
{
 int n,k;
 scanf("%d%d%s",&n,&k,s);
 for(int i=0;i<n;i++)
 {
  a[s[i]-'a']++;
 }
 for(int i=0;i<26;i++)
 {
   if(a[i]>k)
   return puts("NO"),0,puts("YES");
 }
 return 0;
}


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

int cmp(const void* a, const void* b)
{
	return (*(int*)a - *(int*)b);
}

int main(void)
{
	int i, j;
	int a[30] = { 0 };
	int n, k;
	int num = 0;
	char x;

	scanf("%d %d", &n, &k);
	getchar();
	for (i = 0; i < n; i++)
	{
		x = getchar();
		a[x - 'a']++;
	}
	for (i = 0; i < 30; i++)
		num = max(num, a[i]);
	if (num > k) printf("NO");
	else printf("YES");

	return 0;
}


#include<bits/stdc++.h>
#include<string>
int main()
{
    int n,k,i,j,flag,count;
    char arr[1000],temp;
    while(scanf("%d %d",&n,&k)==2)
    {
        scanf("%s",arr);
        flag=0;
        for(i=0; i<n; i++)
        {
            temp=arr[i];
            count=0;
            for(j=0; j<n; j++)
            {
                if(arr[j]==temp)
                {
                    count++;
                }
            }
            if(count>k){
                flag=1;
                break;
            }
            else
                continue;
        }
        if(flag==1)
            printf("NO\n");
        else
            printf("YES\n");

    }
    return 0;
}


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

long long int c1,c2,x,y;

long long int check(long long int a)
{
	return (((a-a/x >= c1) && (a-a/y >= c2)) && (a-a/(x*y) >= c1+c2));
}

int main()
{
	scanf("%lld %lld %lld %lld",&c1,&c2,&x,&y);
	long long int high = INT_MAX,low=0,mid;
	while(high>low)
	{
		mid = high+low;
		mid /= 2;
		if(check(mid))
			high = mid;
		else
			low = mid+1;
	}
	printf("%lld\n",high);
	return 0;
}


#include<stdio.h>

int c1, c2, x, y, ans;
int main()
{
    scanf("%d%d%d%d", &c1, &c2, &x, &y);

    ans = c1+c2;
    while(ans - ans/x < c1)
    {
        ans += c1 - (ans - ans/x);
    }
    while(ans - ans/y < c2)
    {
        ans += c2 - (ans - ans/y);
    }
    while(ans - ans/(x*y) < c1+c2)
    {
        ans += (c1+c2) - (ans - ans/(x*y));
    }
    printf("%d\n", ans);
    return 0;
}


//friends and presents Federico Bellini
#include <stdlib.h>
#include <stdio.h>

int main () {
    int a,b;
    int x,y;

    scanf("%i %i", &a, &b);
    scanf("%i %i", &x, &y);

    int i = 0;
    while(a > 0 || b > 0){
        ++i;

        if((i%x != 0) && (i%y != 0)){
            if(a>b && a>0) a--;
            else b--;
        }
        else if((i%x != 0) && (a>0)){
            a--;

        }
        else if((i%y != 0) && (b>0)){
            b--;
        }
    }

    printf("%i\n", i);
}


#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
	int cnt1, cnt2, x, y, v;
	cin >>cnt1>>cnt2>>x>>y;
	v = cnt2 + cnt1 + cnt1/x + cnt2/y;
	v -= (cnt1>cnt2)? cnt1/(x*y) : cnt2/(x*y);
	cout <<v;
	return 0;
}


#include<iostream>
#include<string>

int main()
{
   int a,b,count=0,count1=0,count2=0;
   float m=0;
    int diffa=0;
    int diffb=0;
  scanf("%d %d",&a,&b);
   //winning of a
   for(int i=1;i<=6;i++)
   {
     diffa=a-i;
     diffb=b-i;
     if(diffb<0)
     {
         diffb=diffb*(-1);

     }

     if(diffa<0)
     {
         diffa=diffa*(-1);
     }
     if(diffa<diffb)
     {
        count++;
     }
     if(diffa==diffb)
     {
         count1++;
     }
     if(diffb<diffa)
     {
         count2++;
     }

   }
   printf("%d %d %d",count,count1,count2);

    return 0;
}


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

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

    int w,d,l;

    for(int i=1;i<=6;i++)
    {
        if(abs(p1-i) < abs(p2-i))
        {
            w++;
        }
        else if(abs(p1-i) > abs(p2-i))
        {
            l++;
        }
        else
        {
            d++;
        }
    }

    printf("%d %d %d",w,d,l);

    return 0;
}


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

int main()
{
  int a,b,k=0,n=0,m=0,i=1;
  scanf("%d%d",&a,&b);
  while(i<=6)
  {
    if(abs(a-i)<abs(b-i))
      k+=1;
      if(abs(a-i)==abs(b-i))
        n+=1;
   if(abs(a-i)<abs(b-i))
     m+=1;
   i++;
   }
    printf("%d %d %d",k,n,m);
    return 0;


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

int main()
{
    int a,b,i,x,y,c1=0,c2=0,c3=0;
    while(scanf("%d %d",&a,&b)==2){
    for(i=1;i<=6;i++){
    x=abs(a-i);
    y=abs(b-i);
    if(x>y)
    c1++;
    if(y>x)
    c2++;
    if(x==y)
    c3++;

    }
     printf("%d %d %d\n",c2,c3,c1);
    return 0;
    }
}


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

int main (void) {
	int a, b, a_win = 0, tie = 0, b_win = 0;
	scanf("%d %d", &a, &b);
	for (i = 1; i <= 6; i++) {
		if(abs(a - i) < abs(b - i)) a_win++;
		if(abs(a - i) > abs(b - i)) b_win++;
		if(abs(a - i) == abs(b - i)) tie++;
	}
	printf("%d %d %d", &a_win, &tie, &b_win);
	return 0;
}


#include<stdio.h>
#define maxn 1000
int a[maxn];
void init();
int main()
{
    init();
    int n,i;
    while(~scanf("%d",&n))
    {
        if(n==1||n==2)
        {
            printf("%d\n",1);
            printf("%d\n",n);
            continue;
        }
        printf("%d\n",a[n]);
        int sum=0;
        for(i=1;i<a[n];i++)
        {
            sum+=i;
            printf("%d ",i);

        }
        printf("%d\n",n-sum);

    }
    return 0;
}

void init()
{
    int s=1;
    int i,j;
    for(i=1;i<=1000;i+=s)
    {
        for(j=i;j<i+s+1;j++)
            a[j]=s;
        s++;

}


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

int main()
{
int x;
printf("enter the number of sweets: ");
scanf("%d", &x);
int a[x], j=0, i, m=0;
while(x!=0)
{
for(i=0; i<x; i++)
{
x = (x-(++j));
a[i] = j;
}
a[i-1]+=x;
x=0;
}
printf("%d\n", i);
for(m=0; m<i; m++)
printf("%d\t", a[m]);
return 0;


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

int main()
{
	int i,j,n,k,br=0;
	int *a,**opt,*b,*niz;

	scanf("%d",&n);

	a=(int*)malloc((n+1)*sizeof(int));
	niz=(int*)malloc((n+1)*sizeof(int));
	b=(int*)malloc((n+1)*sizeof(int));
	opt=(int**)malloc((n+1)*sizeof(int*));

	if(n==1 || n==2){
		printf("1\n%d",n);
		return 0;
	}

	for(i=1;i<=n;i++){
		a[i]=i;
		b[i]=1;
		opt[i]=(int*)malloc((n+1)*sizeof(int));
	}

	for(i=0;i<n;i++){
		opt[i][0]=0;
		opt[0][i]=0;
	}

	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(a[i]<=j && opt[i-1][j-a[i]]+b[i]>opt[i-1][j])
				opt[i][j]=opt[i-1][j-a[i]]+b[i];
			else
				opt[i][j]=opt[i-1][j];
		}
	}

	i=n;j=n;
	while(opt[i][j]!=0){
		if (opt[i][j] == opt[i-1][j]) {
			i--;
		}
		else {
			niz[br++]=i;
			j -= zapr[i];
			i--;
		}
	}

	printf("%d\n",br);
	for(i=br-1;i>=0;i--)
		printf("%d ",niz[i]);

	return 0;
}


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

int main()
{
    int N;

    while(scanf("%d",&N)==1)
    {
        for(int l=1; l<=1000; l++)
        {
            getchar();
            N = l;
            N++;
            int A[N];
            for(int i=1; i<N; i++)
                A[i] = 0;

            int i,j,kid = 0,Sum = 0;

            for(i=1; i<N; i++)
            {
                Sum = Sum+i;
                if(Sum<= (N-1))
                {
                    A[i] = 1;
                    kid++;
                    if(Sum == N-1)
                        break;
                }
                else
                {
                    A[Sum-(N-1)] = 0;
                    A[i] = 1;
                    break;
                }
            }

            printf("%d\n",kid);
            for(i = 1; i<N; i++)
            {
                if(A[i]==1)
                {
                    printf("%d",i);
                    kid--;
                    if(kid)
                        printf(" ");
                }
            }
            printf("\n");
        }
    }

    return 0;
}


#include<stdio.h>
#include<math.h>
typedef long long int ll;
int main()
{
	ll n,k;
	scanf("%lld%lld",&n,&k);
	ll ans=n;
	ll count=1,i;
/*	for(i=n-1;i>=n/2;i--)
	{
		ll temp=ans^i;
		if(temp>ans)
		{
			ans=temp;
			count++;
		}
		if(count==k) break;
//		if(ans==(pow()-1)) break;
	}*/
	for(i=n/2;i>0;i/=2)
	{
		if(count==k) break;
		ll temp=ans^i;
		if(temp>ans)
		{
			ans=temp;
			count++;
		}

	}

	printf("%lld",ans);

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
    int len;
    char buf[100]={0};
    long long n,k,p;
    scanf("%lld%lld",&n,&k);
    if(k==1)
    {
        printf("%lld",n);
        return 0;
    }
    _itoa(n,buf,2);
    len=strlen(buf);
    p=pow(2,len)-1;
    printf("%lld",p);
    return 0;
}


#include<stdio.h>
#include<math.h>
int cnt=0,a[1000000];
int n,k;
void dfs(int step,int sum,int b)
{
	int i;
	if(step==k){
		a[cnt++]=sum;
		return;
	}
	for(i=b;i<=n;i++){
		if((sum^i)>sum)
			dfs(step+1,sum^i,i+1);
	}
	a[cnt++]=sum;
}
int main()
{
	int i,max=0;
	scanf("%d %d",&n,&k);
	for(i=1;i<=n;i++){
		dfs(1,i,i+1);
	}
	for(i=0;i<cnt;i++){
		if(max<a[i])max=a[i];
	}
	printf("%d",max);
	return 0;
}


#include<stdio.h>
#include<math.h>
int main(){
	long long int n,k,i=0;
	scanf("%I64d %I64d", &n, &k);
	if(k==1)
		printf("%I64d",n);
	else
	{
		i=0;
		while((long long int)pow(2,i)<=n)
			i++;
		printf("%I64d",(long long int)pow(2,i)-1);
	}
	return 0;


#include <stdio.h>
#include<stdlib.h>
#include<string.h>
int main(){
    int t1;
    int t2;
    int t3;
    int t4;
        scanf("%d",&t1);
        scanf("%d",&t2);
        scanf("%d",&t3);
        scanf("%d",&t4);
if((t1+t2+t3+t4)==0){
    printf("0");
}else
{
    if(t1==t4){
        if(t1==0&&t3!=0){
            printf("0");
        }else{
            printf("1")
        }
    }else{
        printf("0");
    }
 /*   if(t3==0){
        if(t1==t4)printf("1");
        else printf("0");
    }else{
        if(t1==0||t4==0)printf("0");
        else if(t1==t4)printf("1");
        else printf("0");
    }*/
}
    return 0;
}


#including <stdio.h>
int main()
{
	int sign=1,done=1;
	float sum=1;
	while (done<=100)
	{
		done=done+1;
		sign=-1*sign;
		sum=sum+sign*1/done;
	}
	printf ("sum=%f",sum);
	return 0;
 }


#include<stdio.h>
int main()
{
    long long int a,b,c,d,i;
    scnaf("%lld%lld%lld%lld",&a,&b,&c,&d);
    if(a==d)printf("1\n");
    else printf("0\n");
    return 0;
}


#include <stdio.h>
#include <string.h>
int main ()
{
	int c1,c2,c3,c4;
	scanf(%d,&c1);
	scanf(%d,&c2);
	scanf(%d,&c3);
	scanf(%d,&c4);
	if(c1!=c4)
	{
		printf("0");

	}
	else
	{
		if c1==0
		{
			if (c3==0)
			{
				return 1;

			}
			else
			{
				return 0;
			}
		}
		else
		{
			return 1;
		}

	}

}


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

int main(){

    int len;
    charch[21];
    gets(ch);

    l=strlen(ch);

    int ans=26*(l*25);
    printf("%d",ans);

}


#include <iostream>

int main{
string s;
int a,b;
scanf("%s",&s);
a=s.length();
b=((a*25)+26);
return 0;
}


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

#define lli long long int
#define MAX INT_MAX
#define sd second
#define fs first
#define endll '\n'
#define PI acos(-1)
#define mp make_pair
#define pb push_back
#define best 1000000007
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>b;i--)
#define buyuk(a,b) (a<b)? b:a
#define kucuk(a,b) (a<b)? a:b
#define ort(a,b) (a+b)/2
#define carp(a,b) (a)*(b)
int main () {
	char a[25];

	int main () {
		scanf("%s",a);
		printf("%d",((int)strlen(a)+1)*25 + 1);
	}


#include<stdio.h>
#include<string.h>;
char a[106];
int main()
{
    char a[100];
    int len,ans;
    scanf("%s",a);
    len=strlen(a);
    ans=25*(l+1)+1;
    printf("%d",ans);
    return 0;
}


#include <iostream>
using namespace std;
int main{
string s;
int a,b;
cin>>s;
a=s.length();
b=((a*25)+26);
cout<<b;
return 0;
}


#define N	6
#define _GNU_SOURCE

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

#define V(a)			((a).type == FIRST ? 9 - (a).value : (a).value)
#define VALUE(a, positive)	((positive) ? 9 - V(a) : V(a))

typedef struct {
	enum {FIRST, SECOND} type;
	int value;
} digit_t;

digit_t a[N];

void getdata(digit_t a[]) {
	for (int i = N / 2; i < N; i++)
		a[i].type = SECOND;
	for (int i = 0; i < N; i++)
		a[i].value = getchar() - '0';
}

int find_diff(digit_t a[]) {
	int sum = 0;
	for (int i = 0; i < N / 2; i++)
		sum += a[i].value;
	for (int i = N / 2; i < N; i++)
		sum -= a[i].value;
	return sum;
}

int cmp(const void *p1, const void *p2, void *arg) {
	const digit_t
		*a = p1,
		*b = p2;
	const bool *positive = arg;

	int
		value1 = VALUE(*a, *positive),
		value2 = VALUE(*b, *positive);
	return value1 - value2;
}

void solve(digit_t a[]) {
	int diff = find_diff(a);
	bool positive = diff > 0;
	qsort_r(a, N, sizeof *a, cmp, &positive);

	diff = abs(diff);
	for (int i = 0; i <= N; i++) {
		if (diff <= 0)  {
			printf("%d\n", i);
			exit(EXIT_SUCCESS);
		}
		diff -= VALUE(a[N - i - 1], positive);
		fprintf(stderr, "Used digit %d with value %d\n", a[N - i - 1].value, VALUE(a[N - i - 1], positive));
	}
}

int main(void) {
	getdata(a);
	solve(a);
	return EXIT_SUCCESS;
}


#include <stdio.h>

int sum(int n) {
	int res;

	for (res = 0; n > 0; n /= 10)
		res += n % 10;

	return res;
}

int ndiff(int a, int b) {
	int res;

	for (res = 0; a > 0 || b > 0; a /= 10, b /= 10)
		if (a % 10 != b % 10)
			res++;

	return res;
}

int main(void) {
	int number;

	scanf("%d", &number);
	//printf("%d\n", sum(number));

	int n1 = number % 1000;
	int n2 = number / 1000;

	int s1 = sum(n1);
	int s2 = sum(n2);

	int number2 = number;
	int n0 = number;

	while (s1 != s2) {
		number++;

		n1 = number % 1000;
		n2 = number / 1000;

		s1 = sum(n1);
		s2 = sum(n2);

		//printf("%d\n", s1 - s2);
	}

	do {
		number2--;

		n1 = number2 % 1000;
		n2 = number2 / 1000;

		s1 = sum(n1);
		s2 = sum(n2);

		//printf("%d\n", s1 - s2);
	} while (s1 != s2);

	//~ printf("%d\n", number);
	//~ printf("%d\n", number2);

	//~ printf("%d\n", ndiff(number, n0));
	//~ printf("%d\n", ndiff(number2, n0));

	int d1 = ndiff(number, n0);
	int d2 = ndiff(number2, n0);

	printf("%d\n", d1 > d2 : d2 : d1);

	return 0;
}


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

int main(int argc, char const *argv[])
{
	int vec[6];

	for (int i = 0; i < 6; ++i)
	{
		scanf("%1d", vec + i);
	}

	if (vec[0] + vec[1] + vec[2]  == vec[3] + vec[4] +vec[5])
	{
		printf("0\n");
		return 0;
	}

	for (int i = 0; i < 10; ++i)
	{
		if (vec[0] + vec[1] + i == vec[3] + vec[4] + vec[5])
		{
			printf("1\n");
			return 0;
		}
		else if (vec[0] + vec[1] + vec[2] == i + vec[4] + vec[5])
		{
			printf("1\n");
			return 0;
		}
		else if (vec[0] + i + vec[2] == vec[3] + vec[4] + vec[5])
		{
			printf("1\n");
			return 0;
		}
		else if (vec[0] + vec[1] + vec[2] == vec[3] + i + vec[5])
		{
			printf("1\n");
			return 0;
		}
		else if ( i + vec[1] + vec[2] == vec[3] + vec[4] + vec[5])
		{
			printf("1\n");
			return 0;
		}
		else if (vec[0] + vec[1] + vec[2] == vec[3] + vec[4] + i)
		{
			printf("1\n");
			return 0;
		}
	}

	for (int j = 0; j < 10; ++j)
	{
		for (int i = 0; i < 10; ++i)
		{
			if (vec[0] + j + i == vec[3] + vec[4] + vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (j + vec[1] + i == vec[3] + vec[4] + vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (j + i + vec[2] == vec[3] + vec[4] + vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + vec[1] + vec[2] == i + j + vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + vec[1] + vec[2] == i + vec[4] + j)
			{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + vec[1] + vec[2] == vec[3] + i + j)
			{
				printf("2\n");
				return 0;
			}
			else if (j + vec[1] + vec[2] == i + vec[4] + vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + j + vec[2]  == i + vec[4] +vec[5])
			{
				printf("2\n", contd);
				return 0;
			}
			else if (vec[0] + vec[1] + j  == i + vec[4] +vec[5])
			{
				printf("2\n", contd);
				return 0;
			}
			else if (j + vec[1] + vec[2] == vec[3] + i + vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + j + vec[2]  ==  vec[3] + i +vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + vec[1] + j  ==  vec[3] + i + vec[5])
			{
				printf("2\n");
				return 0;
			}
			else if (j + vec[1] + vec[2] ==  vec[3] + vec[4] + i)

			{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + j + vec[2]  ==  vec[3] + vec[4] + i)
							{
				printf("2\n");
				return 0;
			}
			else if (vec[0] + vec[1] + j  ==  vec[3] + vec[4] + i)
							{
				printf("2\n");
				return 0;
			}
		}
	}

	for (int  k = 0; k < 10; ++k)
	{
		for (int j = 0; j < 10; ++j)
		{
			for (int i = 0; i < 10; ++i)
			{
				if (k + j + i == vec[3] + vec[4] + vec[5])
				{
					printf("3\n");
					return 0;
				}
				else if (vec[0] + vec[1] + vec[2] == i + j + k)
				{
					printf("3\n");
					return 0;
				}
			}
		}

	}

	return 0;
}


#include <stdio.h>

int main()
{
	int array[6]={0};
	int t1=0,t2=0,s=0,t,a=0,b;
	for(int i=0;i<3;i++)
	{
		scanf("%c",&b);
		b-=48;
		t1+=b;
	}
	for(int i=3;i<6;i++)
	{
		scanf("%c",&b);
		b-=48;
		t2+=b;
	}
	for(int i=0;i<3;i++)
	{
		for(int k=i+1;k<3;k++)
		{
			if(array[k]<array[i])
			{
				t=array[k];
				array[k]=array[i];
				array[i]=t;
			}
		}
	}
	for(int i=3;i<6;i++)
	{
		for(int k=i+1;k<6;k++)
		{
			if(array[k]<array[i])
			{
				t=array[k];
				array[k]=array[i];
				array[i]=t;
			}
		}
	}
	if(t1>t2)
	{
		for(int i=3;i<6;i++)
		{
			a+=9-array[i];
			s++;
			if(t1-t2<a) break;
		}
	}
	else if(t2>t1)
	{
		for(int i=0;i<3;i++)
		{
			a+=9-array[i];
			s++;
			if(t2-t1<a) break;
		}
	}
	printf("%d\n", s);
	return 0;
}


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

int judge(long long int N,long long int n,long long int m,long long int k)
{
    long long int i,count=0;
    for(i=1;i<=m;i++){
        if(N/i>=n){
            count+=n;
        }
        else{
            count+=N/i;
        }
    }
    if(count>=k){
        return 1;
    }
    else{
        return 0;
    }
}

int main(void)
{
    long long int n,m,k;
    scanf("%I64d %I64d %I64d",&n,&m,&k);
    long long int i,j;
    long long int low,mid,high,answer;
    low=0;
    high=n*m;
    mid=(low+high)/2;
    while(1){
        if(judge(mid,n,m,k)==1){
            if(judge(mid-1,n,m,k)==0){
                answer=mid;
                break;
            }
            else{
                high=mid;
                mid=(low+high)/2;
            }
        }
        else{
            low=mid;
            mid=(low+high)/2;
        }
    }
    printf("%I64d",answer);
    return 0;
}


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

int main(void)
{
    long long int n,m,k;
    scanf("%I64d %I64d %I64d",&n,&m,&k);
    long long int i,j;
    long long int count,answer;
    if(k==n*m){
        printf("%I64d",k);
        return 0;
    }
    for(i=1;i<=n*m;i++){
        count=0;
        for(j=1;j<=m;j++){
            if(i/j>=n){
                count+=n;
            }
            else{
                count+=i/j;
            }
            if(count>=k){
                answer=i;
                printf("%I64d",answer);
                return 0;
            }
        }
    }
    return 0;
}


#include<stdio.h>
#include<limits.h>
int n, m, k;
int bs2(int multi,int x)
{
	int mid, left = 0, right = m;
	while (left <= right)
	{
		mid = (left + right) / 2;
		if (x >= mid * multi && x < (mid + 1)*multi)
		{
			//printf("第%d行有%d个\n", multi, mid);
			return mid;
		}
		if (mid*multi < x)
			left = mid + 1;
		else
			right = mid - 1;
	}
	//printf("第%d行有%d个\n", multi, mid);
	return mid;
}
int judge(int x)//小于等于x的数有多少个
{
	int i, count = 0;
	for (i = 1; i <= n; i++)
	{
		count += bs2(i, x);
	}
	return count;
}
int bs1(int left,int right)
{
	int mid;
	while (left <= right)
	{
		mid = (left + right) / 2;
	/*	printf("小于等于%d的数有多少\n", mid);*/
		int count1 = judge(mid),count2 = judge(mid-1);
		if (k <= count1 && k > count2)
			return mid;
		if (k >= count1)
			left = mid + 1;
		else right = mid - 1;
	}
	//printf("%d %d\n", mid, mid - 1);
	return mid;
}
int main()
{
	scanf("%d %d %d", &n, &m, &k);
	printf("%d", bs1(1, n*m));
}


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

void merge(long long arr[],int mid,int last){

        int i=0,j;
        j=mid+1;
        int c=0;
        long long mer[last+1];

        while(i<=mid && j<=last){
            if(arr[i]<=arr[j]){
                mer[c]=arr[i];
                i++;c++;
            }
            else{
                mer[c]=arr[j];
                j++;c++;
            }
        }
        int k;
        if(i>mid){
            for(k=j;k<=last;k++){
                mer[c]=arr[k];
                c++;
            }
        }
        else{
            for(k=i;k<=mid;k++){
                mer[c]=arr[k];
                c++;
            }
        }
        for(k=0;k<=last;k++){
            arr[k]=mer[k];
        }

}

int main()
{
    int n,m;
    int i,j;
    long long k;
    int c=0;
    scanf("%d %d %I64d",&n,&m,&k);
    long long arr[n*m];
    int f=0;
    for(i=1;i<=n;i++){
         int temp=c-1;
        for(j=1;j<=m;j++){
            arr[c]=i*j;
            c++;
        }
        if(f==1){
            merge(arr,temp,c);
        }
        f=1;
    }

    printf("\n");
    printf("%I64d",arr[k-1]);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare (const void * a, const void * b)
{
  return ( *(int*)a - *(int*)b );
}

int mask(int x){
    int k = 0, t = 1;
	while (x > 0) {
	    if (x % 10 == 7 || x % 10 == 4) {
		    k += x%10*t;
			t *= 10;
		}
		x = x/10;
	}
	return(k);
}

int main() {
    int a, b, i;
	scanf("%d %d",&a,&b);
	printf("%d %d\n",a,b);
	for (i = a;mask(i) != b;i++);
	printf("%d\n",i);
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare (const void * a, const void * b)
{
  return ( *(int*)a - *(int*)b );
}

int mask(int x){
    int k = 0, t = 1;
	while (x > 0) {
	    if (x % 10 == 7 || x % 10 == 4) {
		    k += x%10*t;
			t *= 10;
		}
		x = x/10;
	}
	return(k);
}

int main() {
    int a, b, i;
	scanf("%d%d",&a,&b);
	for (i = a;mask(i) != b;i++);
	printf("%d\n",i);
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare (const void * a, const void * b)
{
  return ( *(int*)a - *(int*)b );
}

int mask(int x){
    int k = 0, t = 1;
	while (x > 0) {
	    if (x % 10 == 7 || x % 10 == 4) {
		    k += x%10*t;
			t *= 10;
		}
		x = x/10;
	}
	return(k);
}

int main() {
    int a, b, i;
	scanf("%d%d",&a,&b);
//	printf("%d %d\n",a,b);
	for (i = a;mask(i) != b;i++);
	printf("%d",i);
}


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

int main()
{
    char s_a[6], s_b[6], s_c[7];
    char t_s_a[6], t_s_b[6];
    char plus_1[10] = "1234567890";
    char plus_2[10] = "2345678901";
    int i_a, i_b, i_c, n_a, n_b, n_c;
    int t_n_a, t_n_b;
    int i;
    int c_point;

    sprintf(s_c,"%d", 0);
    scanf("%d %d", &i_a, &i_b);
    sprintf(s_a,"%d",i_a);
    sprintf(s_b,"%d",i_b);
    n_a = strlen(s_a);
    n_b = strlen(s_b);
    strcpy(t_s_a, s_a);
    strcpy(t_s_b, s_b);
    //printf("%s %s %d %s %d\n",s_c, s_a, n_a, s_b, n_b);

    if(i_a < i_b){
        i_c = i_b;
        sprintf(s_c,"%d", i_c);
        printf("%s", s_c);
        return 0;
    }else if( i_a >= i_b && n_a == n_b){
        i_c = i_b + pow(10,n_b);
        sprintf(s_c,"%d", i_c);
        printf("%s", s_c);
        return 0;
    }

    t_n_a = n_a;
    t_n_b = n_b;
    n_c = n_a;

    //return 0;
    c_point = 0;
    while(t_n_a != t_n_b){
        if((t_s_a[0] == '4' && t_s_b[0]== '7') || (t_s_a[0] == '7' && t_s_b[0]== '4')){
            s_c[c_point] = plus_1[t_s_a[0]-48];
            printf("\n%c",s_c[0]);
            return 0;
        }
    }

    return 0;
}


#include <stdio.h>
#include <math.h>
int flag=0,b;
void mask(int c)
{
	int d=c,arr[100002],a[100002]={0};
	int i=0;
	while(d>0)
	{
		if(d%10==4 || d%10==7)
		{
			arr[i]=d%10;
			i++;
		}
		d=d/10;
	}
	int ans=0;
		for(int j=0;j<i;j++)
		{
			ans=ans+arr[j]*pow(10,j);
		}
	if(ans==b)
		flag=1;
//		printf("\n");
	int e=b,count=0;
/*	if(i!=0)
	{
		while(e>0)
		{
			if(e%10==arr[i-count-1])
			{
				count++;
			}
			e=e/10;
		}
		if(count==i)
		{
			flag=1;
		}
	}*/
}
int main()
{
	int a;
	int c;
	scanf("%d",&a);
	scanf("%d",&b);
	c=a+1;
	while(c>a)
	{
		mask(c);
		if(flag==1)
		{
			printf("%d\n",c);
			break;
		}
		c++;
	}
	return 0;
}


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

int Min(int a, int b)
{
    return a < b ? a:b;
}
int main()
{
    int n,x1,x2,t1,t2,p,d;
    int t3,t4,ans;
    while(scanf("%d %d %d",&n,&x1,&x2)==3)
    {
        scanf("%d %d %d %d",&t1,&t2,&p,&d);
        if(x2 > x1)
        {
            t3 = (x2 - x1) * t2;
            if(d == 1)
            {
                if(p > x1)
                    t4 = (n - p + n * 2) * t1;
                else
                    t4 = (n - p) * t1;
            }
            else
                t4 = (n + p) * t1;
        }
        else
        {
            t3 = (x1 - x2) * t2;
            if(d == 1)
                t4 = (n - p + n) * t1;
            else
            {
                if(p < x1)
                    t4 = (p + n * 2) * t1;
                else
                    t4 = (n - p) * t1;
            }
        }
        ans = Min(t3, t4);
        printf("%d\n",ans);
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
long long int min(long long int a,long long int b)
{
	if(a<=b)
		return a;
	else
		return b;
}
int main()
{
	long long int s,x1,x2,t1,t2,p,d,temp1,temp2,ans;
	scanf("%lld %lld %lld",&s,&x1,&x2);
	scanf("%lld %lld",&t1,&t2);
	scanf("%lld %lld",&p,&d);
	if(x1<x2)
	{
		temp1=(x2-x1)*t2;
		if(d==1)
		{
			if(p<=x1)
			{
				temp2=(x2-p)*t1;
				ans=min(temp1,temp2);
			}
			else
				ans=temp1;
		}
		else
		{
			temp2=(x2+p)*t1;
			ans=min(temp1,temp2);
		}
	}
	else
	{
		temp1=t2*(x1-x2);
		if(d==-1)
		{
			if(p<=x1)
			{
				temp2=t1*(x2-p);
				ans=min(temp1,temp2);
			}
			else
				ans=temp1;
		}
		else
		{
			temp2=t1*(s+s-p-x2);
			ans=min(temp1,temp2);
		}
	}
	printf("%lld\n",ans);
	return 0;
}


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


#include<stdio.h>

int main()
{
	int a[100];
	int b;
	int c;
	int j;
	scanf("%d",&j);
	for(int i=0;i<j;i++)
		scanf("%d",&a[i]);
	for(i=0;i<j;i++)
	{
		if(a[i]>=0)
			b=b+a[i];
		else
			c=c+a[i];
	}
	printf("%d",b-c);
	return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="Partition" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/Partition" 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/Partition" 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 />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


#include<stdio.h>
int man()
{
    int arr[105],i,B=0,C=0,n;
    scanf("%d",&n);
    for(i=0;i<n;i++){
    scanf("%d",&arr[i]);
    }
    for(i=0;i<n;i++){
        if(arr[i]<0) C=C+1;
        else B=B+1;
    }
    printf("%d",B-C);
    return 0;

}


#include<stdio.h>
int man()
{
    int arr[105],i,B=0,C=0,n;
    scanf("%d",&n);
    for(i=0;i<n;i++){
    scanf("%d",&arr[i]);
    }
    for(i=0;i<n;i++){
        if(arr[i]<0) C=C+arr[i];
        else B=B+arr[i];
    }
    printf("%d",B-C);
    return 0;

}


#include <stdio.h>
#include <math.h>
int main()
{
    float x, y, n, a, b, min=10000000, ansb;
    int i;
    scanf("%f %f %f", &x, &y, &n);
    if(y<=n)
        printf("%d/%d\n", (int)x, (int)y);
    else
    {
        b=n-1;
        if(b==0)
        {
            printf("0/1\n");
            return 0;
        }
        for(b=n-1; b>0; b--)
        {
            for(i=b-1; i>0; i--)
            {
                float temp=(float)i;
                float temp1=x/y;
                float temp2=temp/b;
                //printf("x/y=%f i/b=%f abs=%f\n", temp1, temp2, fabs(temp1-temp2));
                if(fabs(temp1-temp2)<min)
                {
                    min=fabs(temp1-temp2);
                    a=temp;
                    ansb=b;
                }
            }
        }
        int inta=(int)a, intb=(int)ansb;
        i=inta;
        if(intb<i)
            i=intb;
        for(i=intb; i>1; i--)
        {
            if(inta%i==0 && intb%i==0)
            {
                inta/=i;
                intb/=i;
                i--;
            }
        }
        printf("%d/%d\n", inta, intb);
    }
}


#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<float.h>
int gcd(int x,int y)
{
    if(y==0)
	return x;
    else return gcd(y,x%y);
}
int main()
{
    int a,b,n,g,i,j,num,den;
    float prev=FLT_MIN,min,prev2=FLT_MAX,least=FLT_MAX,temp;
    scanf("%d%d%d",&a,&b,&n);
    min= (float)a/(float)b;
    g=gcd(a,b);
    a=a/g;
    b=b/g;
    if(b<=n)
	printf("%d/%d\n",a,b);
    else
    {
	for(i=n;i>=1;i--)
	{
	    for(j=a;j>=0;j--)
	    {
		temp=(float)j/(float)i;
		if( least >= fabsf(min-temp) )
		{
		    num=j;
		    den=i;
		    least=fabsf(min-temp);
		}
	//	printf("min: %f temp :%f least%f j:%d i:%d num:%d den:%d\n",min,temp,least,j,i,num,den);
		if((min>temp && temp<prev) || (min<temp && temp>prev2 ))
		{
		    break;
		}
		    prev=temp;
		//	else if(fabsf(temp<least)
		//	{
		//	    break;
		//	}
	    }
	    //	break;
	}
	printf("%d/%d\n",num,den);
    }
    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.49999999999);
        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 <math.h>

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

    int a, b, i;
    double ratio = (double)x/y;

    double sol = 10000000;
    double dist;
    for (i=1;i<=n;i++){
        int j = roundtol(ratio * i);
        if (ratio*i - floor(ratio*i) == 0.5){
            j = (int)(ratio*i);
        }
        dist = fabs(ratio - (double)j/i);
        if (sol>dist){
            sol = dist;
            b = i;
            a = j;
        }
    }

    printf("%d/%d\n", a, b);

    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.4999999999);
        tmpmin = fabs((x*1.0) / y - (p*1.0) / i);
        if (min > tmpmin)
        {
            min = tmpmin;
            a = p;
            b = i;
        }
    }
    printf("%d/%d", a, b);
    return 0;


#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    int c = (a+b)/2;
    int p =0;
    for(int i = 0;i<=abs(c-a);i++)
        p += i;
    for(int j = 0;j<=abs(c-b);j++)
        p += j;
    cout<<p<<endl;
    return 0;

}


#include<iostream>
#include<stdlib.h>
using namespace std;
int main(void)
{

    int nA,nB,T;
    int a,b;
    cin>>a;
    cin>>b;
    if((b-a)%2==0)
    {
        nA=nB=abs((b-a)/2);
    }
    else {

           nA=abs((b-a)/2);
           nB=nA+1;
    }

    T=nA*(nA+1)/2 + nB*(nB+1)/2;
    cout<<T;

}


#include <stdio.h>
int processmonth(int dd, int mm, int yy, int by, int bm, int bd){
  if((bm>12)||(((by+18)==yy)&&(mm<bm)))
    return 0;
  if(bd>31)
    return 0;
  if((bm==mm)&&((by+18)==yy))
    if(bd>dd)
      return 0;
  if((bm==4)||(bm==6)||(bm==9)||(bm==11)){
    if(bd>30)
      return 0;
  }
  if(bm==2){
    if((by%4)==0){
      if(bd>29)
        return 0;
    }
    else
      if(bd>28)
        return 0;
  }
  return 1;
}
int processyear(int dd, int mm, int yy, int by, int z1, int z2){
  if((by+18)>yy)
    return 0;
  int t=0;
  t=t+processmonth(dd,mm,yy,by,z1,z2);
  t=t+processmonth(dd,mm,yy,by,z2,z1);
  return t;
}
int main(){
  int t = 0;
  int c,x,dd,mm,yy,x1,x2,x3;
  c=getchar();
  dd=(c-'0')*10;
  c=getchar();
  dd=dd+c-'0';
  c=getchar();
  c=getchar();
  mm=(c-'0')*10;
  c=getchar();
  mm=mm+c-'0';
  c=getchar();
  c=getchar();
  yy=(c-'0')*10;
  c=getchar();
  yy=yy+c-'0';
  c=getchar();
  c=getchar();
  x1=(c-'0')*10;
  c=getchar();
  x1=x1+c-'0';
  c=getchar();
  c=getchar();
  x2=(c-'0')*10;
  c=getchar();
  x2=x2+c-'0';
  c=getchar();
  c=getchar();
  x3=(c-'0')*10;
  c=getchar();
  x3=x3+c-'0';
  t=t+processyear(dd,mm,yy,x1,x2,x3);
  t=t+processyear(dd,mm,yy,x2,x1,x3);
  t=t+processyear(dd,mm,yy,x3,x1,x2);
  if(t>0)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}


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

typedef struct {
	int d, m, a;
} data_t;

int isValid( data_t data ){

	if( data.m > 12 ) return 0;

	if( data.m == 1 || data.m == 3 || data.m == 5 || data.m == 7 || data.m == 8 || data.m == 10 || data.m == 12 )
	{
			if( data.d > 31 ) return 0;
	}
	else if( data.m == 2 ){

		if( data.a % 4 ){
			if( data.d > 28 ) return 0;
		} else if( data.d > 29 ) return 0;

	} else if( data.d > 30 ) return 0;

	return 1;
}

int age( data_t nasc, data_t cur ){

	if( cur.a < nasc.a ) return 0;

	int age = ( cur.a - nasc.a );

	if( nasc.m < cur.m ) return age;
	else if( nasc.m > cur.m ) return age - 1;
	else {

		if( nasc.d <= cur.d ) return age;
		else return age-1;
	}

}

int main(){

	data_t cont, d1, d2, d3, d4, d5, d6;

	scanf("%d.%d.%d", &cont.d, &cont.m, &cont.a );
	scanf("%d.%d.%d", &d1.d, &d1.m, &d1.a );

	d2.d = d1.m; d2.m = d1.d; d2.a = d1.a;
	d3.d = d1.a; d3.m = d1.d; d3.a = d1.m;

	d4.d = d1.d; d4.m = d1.a; d4.a = d1.m;
	d5.d = d1.m; d5.m = d1.a; d5.a = d1.d;
	d6.d = d1.a; d6.m = d1.m; d6.a = d1.d;

	if( isValid( d1 ) && age( d1, cont ) >= 18 ){ puts("YES");
	} else if( isValid( d2 ) && age( d2, cont ) >= 18 ){ puts("YES");
	} else if( isValid( d3 ) && age( d3, cont ) >= 18 ){ puts("YES");
	} else if( isValid( d4 ) && age( d4, cont ) >= 18 ){ puts("YES");
	} else if( isValid( d5 ) && age( d5, cont ) >= 18 ){ puts("YES");
	} else if( isValid( d6 ) && age( d6, cont ) >= 18 ){ puts("YES");
	} else puts("NO");

	return 0;
}


#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(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>
#include <string.h>
#include <math.h>
#include <stdlib.h>

int main()
{
    int a,n,i,j,counter=0;
    scanf("%d%d",&n,&a);
    a-=1;
    int arr[n];
    for(i=0; i<n; i++)
        scanf("%d",&arr[i]);
    if(arr[a]==1)
        counter++;
    for(i=a-1,j=a+1;; i--,j++)
    {
        if(i<0 && j>=n)
            break;a
        if(arr[i]==1&&arr[j]==1)
            counter+=2;
        else if((arr[i]==1 && j>=n) || (arr[j]==1 &&i<0))
            counter++;
    }
    printf("%d",counter);
    return 0;
}


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


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

int main()
{
    int n,i,x,count=0,flag=0;
    int a[LEN];
    char ch;

    scanf("%d",&n);

    for(i=1;i<=n;i++)
    {
        x=i;
        int numlen=0;
        flag=0;
        while(x!=0)
        {
            numlen++;
            if(x%10==0 || x%10==1)
            {
                flag++;
            }
            x/=10;

        }
        if(flag==numlen)
        {
            count++;
        }
    }
    printf("%d",count);
    return 0;
}


#include <stdio.h>
#define gc getchar_unlocked()
int main(){
    long long ans = 0, P = 1e9+7, f=0;
    for(char c=gc;c!='\n';f=f|(c>'1'),ans=f?((ans<<1)|1)%P:((ans<<1)|(c-'0'))%P,c=gc);
    printf("%I64d\n",ans);
    return 0;
}


#include<stdio.h>
#include<cstring>
char a[20];
int num[20],ans=0,len;
int sum[20],c[20];

void pre(){
	c[0]=1;//2^i
	for(int i=1;i<=20;++i){
		c[i]=1;
		c[i]<<=i;
	}
	sum[0]=1;
	for(int i=1;i<=20;++i){
		sum[i]=sum[i-1]+c[i];
	}
}

void cal(){
	ans=0;
	int len=strlen(a);
	for(int i=0;i<len;++i){
		num[len-i-1]=a[i]-'0';
	}
	for(int i=len-1;i>=0;--i){
		if(num[i]>1){
			ans+=sum[i];
			break;
		}
		if(num[i]==1){
			ans+=sum[i-1]+1;
		}
	}
}

int main(){
	pre();
	scanf("%s",a);
	cal();
	printf("%d",ans);
}


#include <stdio.h>
#define gc getchar_unlocked()
int main(){
    long long ans = 0, P = 1e9+7, f=0, c;
    for(c=gc;c!='\n';f=f|(c>'1'),ans=f?((ans<<1)|1)%P:((ans<<1)|(c-'0'))%P,c=gc);
    printf("%I64d\n",ans);
    return 0;
}


#include<stdio.h>
main()
{
	int c=0,a,b,i;
	long long int n;
	scanf("%ld",&n);
	for(i=1;i<=n;i++)
	{
	    b=i;
	    while(b!=0)
		{
		    a=b%100;
		    b=b/100;
		    if(a==1 || a==0 || a==10 || a=11)
		    {
		        if(b==0)
		        c++;
		        else
		        continue;
		    }
		    else
		    break;
		}
	}
	printf("%d",c);
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MOD 1000000007
int a,b,n,sum;
long long int c[500010];
long long int ans;
int i,j;
int judge(int x)
{
    char tmp[1000010];
    sprintf(tmp,"%d",x);
    int len=strlen(tmp);
    for(j=0;j<len;j++)
        if(tmp[j]-'0'!=a&&tmp[j]-'0'!=b)
            return 0;
    return 1;
}
int e_e(int l,int m,long long int &x,long long int &y)
{
    if(m)
    {
        int h;
        h=e_e(m,l%m,x,y);
        long long int tmp=x;
        x=y;
        y=tmp-l/m*x;
        return h;
    }
    else
    {
        x=1;
        y=0;
        return l;
    }
}
int main()
{
    scanf("%d%d%d",&a,&b,&n);
    sum=a*n-b+a;
    c[0]=1;
    for(i=1;i<=n/2+1;i++)
    {
        long long int k,x,y;
        e_e(i,MOD,x,y);
        k=x+MOD;
        c[i]=(c[i-1]*(n+1-i)*k)%MOD;
    }
    for(i=0;i<=n;i++)
    {
        sum+=b-a;
        if(judge(sum))
        {
            ans+=c[i<n-i?i:n-i];
            ans%=MOD;
        }
    }
    printf("%lld",ans);
    system("pause");
    return 0;
}


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

#define ARRAY_SIZEOF(a) (sizeof(a) / sizeof(a[0]))
#define ZERO(p, n)      memset(p, 0, n);

#define MOD 1000000007

typedef long long int lli;

int a, b, n;

int madd(int a, int b)
{
    return (int)( ((lli)a + (lli)b) % MOD );
}

/* Gets nth digit of `n` in decimal form. Digits counted from the rightmost,
   least significant, which is 0
*/
int nth_digit(int j, int n)
{
    while (n != 0) {
        int d = n % 10;
        n /= 10;
        if (j == 0) {
            return d;
        }
        j--;
    }
    return 0;
}

int get_num(int k)
{
    return b * k + (n - k) * a;
}

int digit_lower_bound(int d, int pos, int lo, int hi)
{
    while (lo < hi) {
        int mid = (lo + hi) / 2;
        int nmid = get_num(mid);
        int dmid = nth_digit(pos, nmid);
        if (d > dmid) {
            lo = mid + 1;
        } else {
            hi = mid;
        }
    }
    return lo;
}

int Cnk(int k, int n)
{
    /* Dynamic programming is here. */
    if (k == 0 && n >= 0) {
        return 1;
    }
    if (n == 0) {
        return 0;
    }
    return madd(Cnk(k, n - 1), Cnk(k - 1, n - 1));
}

int solve(int pos, int lo, int hi);

int solve_digit(int d, int pos, int lo, int hi)
{
    int d_lo = digit_lower_bound(d, pos, lo, hi);
    if (nth_digit(pos, get_num(d_lo)) == d) {
        int d_hi = digit_lower_bound(d + 1, pos, lo, hi);
        return solve(pos - 1, d_lo, d_hi);
    }
    return 0;
}

int solve(int pos, int lo, int hi)
{
    int i, a_res, b_res;

    if (lo == hi) {
        return 0;
    }
    if (pos < 0) {
        int count = 0;
        for (i = lo; i < hi; ++i) {
            int ck = Cnk(i, n);
            count = madd(count, ck);
        }
        return count;
    }

    a_res = solve_digit(a, pos, lo, hi);
    b_res = solve_digit(b, pos, lo, hi);
    return madd(a_res, b_res);
}

int main(int argc, char **argv)
{
/*
#ifndef ONLINE_JUDGE
     freopen("in", "r", stdin);
 #endif
*/
    int max_sum, pos = 6, combinations;

    scanf("%d%d%d", &a, &b, &n);
    if (a > b) {
        int temp = a;
        a = b;
        b = temp;
    }

    /* Simplify a bit by reducing leading digits that are zeroes */
    max_sum = b * n;
    while (nth_digit(pos, max_sum) == 0) {
        pos--;
    }

    combinations = solve(pos, 0, n + 1);
    printf("%d\n", combinations);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define MOD 1000000007
int a,b,n,sum;
long long int c[500010];
long long int ans;
int i,j;
int judge(int x)
{
    char tmp[1000010];
    sprintf(tmp,"%d",x);
    int len=strlen(tmp);
    for(j=0;j<len;j++)
        if(tmp[j]-'0'!=a&&tmp[j]-'0'!=b)
            return 0;
    return 1;
}
int e_e(int l,int m,long long int *x,long long int *y)
{
    if(m)
    {
        int h;
        h=e_e(m,l%m,x,y);
        long long int tmp=*x;
        *x=*y;
        *y=tmp-l/m*(*x);
        return h;
    }
    else
    {
        *x=1;
        *y=0;
        return l;
    }
}
int main()
{
    scanf("%d%d%d",&a,&b,&n);
    sum=a*n-b+a;
    c[0]=1;
    for(i=1;i<=n/2+1;i++)
    {
        long long int k,t,r;
        long long int *x=&t,*y=&r;
        e_e(i,MOD,x,y);
        k=*x+MOD;
        c[i]=(c[i-1]*(n+1-i)*k)%MOD;
    }
    for(i=0;i<=n;i++)
    {
        sum+=b-a;
        if(judge(sum))
        {
            ans+=c[i<n-i?i:n-i];
            ans%=MOD;
        }
    }
    printf("%lld",ans);
    return 0;
}


#include<stdio.h>
#include<string.h>
#define Min(x,y) ((x<y)?x:y)

int a,b,n;
int jugde(int i)
{
    while(i)
    {
        if(i % 10 == a || i % 10 == b)
            i /= 10;
        else
            return 0;
    }
    return 1;
}

long long p(int x, int y)
{
    long long ans = 1;
    int i;
    for(i = 1; i <= x; i ++)
        ans = (ans * (y --) / i ) % 1000000007;
    return ans;
}

int main()
{
    while(scanf("%d%d%d",&a,&b,&n) != EOF)
    {
        int first = a * n,last = b * n,step = b - a;
        int i;
        long long ans = 0;
        for(i = first; i <= last; i += step)
        {
            if(jugde(i))
            {
                ans = (ans + p(Min((last - i) / step,(i - first) / step),n)) % 1000000007;
            }
        }
        printf("%I64d\n",ans);
    }
    return 0;
}


//+++++++++++++++++++++++++++++//
//      Karan Aggarwal         //
//       IIIT-Hyderabad        //
//+++++++++++++++++++++++++++++//
// Topic:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<limits.h>
#include<math.h>
#define si(n) scanf("%d",&n)
#define rep(i,n) for(i=0;i<n;i++)
#define REP(i,a,b) for(i=a;i<b;i++)
#define pn printf("\n")
#define pw printf(" ")
#define pi(n) printf("%d",n)
#define pll(n) printf("%lld",n)
#define sll(n) scanf("%lld",&n)
#define ss(s) scanf("%s",s)
#define ps(s) printf("%s",s)
#define mod 1000000007
typedef long long LL;
//inline int readint(){int n=0;char c;while(1){ c=getchar_unlocked();if(c=='\n'||c==' '||c==EOF)break;n=(n<<3) + (n<<1) +c-'0';}return n;}
//inline long long readlonglong(){long long n=0;char c;while(1){ c=getchar_unlocked();if(c=='\n'||c==' '||c==EOF)break;n=(n<<3) + (n<<1) +c-'0';}return n;}
int abs(int a){ if(a<0)return -1*a; return a;}
int big(int a,int b){if(a>b)return a;return b;}
int small(int a,int b){if(a<b)return a;return b;}
int compare(const void *a, const void *b)
{
    int *p1=(int*)a;
    int *p2=(int*)b;
    return *p1-*p2;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int aa,bb;
int isgood(int x)
{
    int N = x;
    while(N)
    {
        if(N%10 != aa && N%10 != bb)
            return 0;
            N/=10;
    }
    return 1;
}
LL  f[10000005];
LL md(LL a)
{
    while(a>=0)a-=1000000007;
    while(a<0)a+=1000000007;
    return a;
}
LL  inv(LL a)
{
    LL B,m,n,x,y,u,v,q,r;
    x=v=0;
    y=u=1;
    LL b = mod;
    B=mod;
    while(a)
    {
        q=b/a;
        r=b%a;
        m=x-u*q;
        n=y-v*q;
        b=a;a=r;
        x=u;y=v;
        u=m;v=n;
    }
    return md(x);
}

int main()
{
    int m,l,ans,sum,min,max,n,i,j,k,x,y,t;
    int counta,countb,mina,maxa;
    si(aa);
    si(bb);
    si(n);
    min = aa*n;
    max = bb*n + 1;
    f[0]=1;
    REP(i,1,max)
        f[i] = (f[i-1]*(LL)i)%mod;

    LL anss=0;
    REP(i,min,max)
    {
        if(isgood(i))
        {
            countb = i-min;
            counta = n-countb;
            anss +=         md(f[n] * inv(f[counta]*f[countb]));

            anss = md(anss);
        }
    }
    pll(md(anss));
    return 0;
}


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

using namespace std;

int main() {
    int x,y;
    scanf("%d%d",&x,&y);
    char a[x+1],b[y+1],c[5];
    scanf("%s%s",a,b);
    c[0]=a[0];c[1]=a[x-1];
    c[2]=b[0];c[3]=b[y-1];
    c[4]='\0';
    if(!strcmp(c,"<>v^") || !strcmp(c,"><^v"))
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}


/*strongly connected city*/
#include<stdio.h>
int main()
{
int m,n,i,ul,ur,dl,dr;
scanf("%d %d",&m,&n);
getchar();
ul=getchar();
for(i=2;i<m;i++)
	getchar();
ur=getchar();
getchar();
dl=getchar();
for(i=2;i<n;i++)
	getchar();
dr=getchar();
//printf("\nul %c ur %c dl %c dr %c",ul,ur,dl,dr);
if(ul!=ur&&dl!=dr)
	printf("YES\n");
else
	printf("NO\n");

return 0;
}


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

int main()
{
    int n,i,j,k,c=0;
    float s=0,sum=0;

    float arr[6];
    for(i=0;i<6;i++){
            scanf("%f",&arr[i]);
         s=s+arr[i];}
         for(i=0;i<4;i++){
            for(j=i+1;j<5;j++){
                for(k=j+1;k<6;k++){
                    sum=arr[i]+arr[j]+arr[k];

                if(sum==s/2)
                   {c++;

                   }}

            }
         }
        if(c==0)
            printf("NO");
        else printf("YES");

    return 0;


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

int main()
{
    int *t;
    int i, j;
    int aux;
    int n;
    int right;

 scanf("%d", &n);
t = malloc(n*sizeof(int));

if(n<2)
{
    printf("-1");
}

if(n>=2)
{
    t[0]=8;
    t[1]=9;
    for(i=2; i<n; i++)
    {
        t[i]=0;

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

free(t);

return 0
}


#include<stdio.h>
int main() {
  int n;
  scanf("%d",&n);
  if(n<3) printf("-1\n");
  else {
    int i;
    for(i=n;i>0;i--) {
      printf(" %d",i);
    ｝
    printf("\n");
  }
  return 0;
}


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


#include<stdio.h>

int main(void)
{
    int n;
    scanf("%d",&n);
    if(n==1 || n==2) {
    	printf("-1");
	}
	else {
		printf("100");
		for(i=1;i<n;i++) {
			printf("1");
		}
	}

    return 0;
}


include<stdio.h>
main()
{
    int n,i,j,k;
    scanf("%d",&n);
    if(n==1||n==2)
    {
        printf("-1");
        return 0;

    }

    printf("2 3 1 ");
    for(i=4;i<=n;i++)
    {
        printf("%d ",i);
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int convert(int a,int b,char c[])
{

    char d[101]="";
    copy(d,c,a,b);
    return atol(d);

}
void copy(char g[],char h[],int A,int B)
{
    int i,j;
    for(i=A,j=0;i<=B;i++,j++)
    {
        g[j]=h[i];
    }

}
int main()
{
	char s[8]="";
	int i,n,max=0,x=0,y=0,z=0,a=0,b=0;
scanf("%s",s);
	for(i=0;s[i]!='\0';i++);
		n=i;
		if(s[0]=='0')
		printf("-1");
		else{
		for(i=0;i<n/2;i++)
		{
        a=i+1;

        b=n-(i+2);
     if(a>b)
     break;

		    x=convert(0,i,s);
		   y=convert(a,b,s);
		   z=convert(b+1,n-1,s);
		   if((x+y+z)>max)
		   max=x+y+z;

		}

		for(i=0;i<n/2;i++)
		{
        a=i+1;

        b=n-(i+2);

		   x=convert(0,i,s);
		   y=convert(a,n-2,s);
		   z=convert(n-1,n-1,s);
		     if((x+y+z)>max)
		   max=x+y+z;

		}

		for(i=0;i<n/2;i++)
		{
        a=i+1;

        b=n-(i+2);

		   x=convert(0,0,s);
		   y=convert(1,b,s);
		   z=convert(b+1,n-1,s);
		     if((x+y+z)>max)
		   max=x+y+z;

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

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int convert(int a,int b,char c[])
{

    char d[101]="";
    copy(d,c,a,b);
    return atol(d);

}
void copy(char g[],char h[],int A,int B)
{
    int i,j;
    for(i=A,j=0;i<=B;i++,j++)
    {
        g[j]=h[i];
    }

}
int main()
{
	char s[100]="";
	int i,n,max=0,x=0,y=0,z=0,a=0,b=0;
scanf("%s",s);
	for(i=0;s[i]!='\0';i++);
		n=i;
		if(s[0]=='0')
		printf("-1");
		else{
		for(i=0;i<n/2;i++)
		{
        a=i+1;

        b=n-(i+2);
     if(a>b)
     break;

		    x=convert(0,i,s);
		   y=convert(a,b,s);
		   z=convert(b+1,n-1,s);
		   if((x+y+z)>max)
		   max=x+y+z;

		}

		for(i=0;i<n/2;i++)
		{
        a=i+1;

        b=n-(i+2);

		   x=convert(0,i,s);
		   y=convert(a,n-2,s);
		   z=convert(n-1,n-1,s);
		     if((x+y+z)>max)
		   max=x+y+z;

		}

		for(i=0;i<n/2;i++)
		{
        a=i+1;

        b=n-(i+2);

		   x=convert(0,0,s);
		   y=convert(1,b,s);
		   z=convert(b+1,n-1,s);
		     if((x+y+z)>max)
		   max=x+y+z;

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

	return 0;
}


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

char s[99];
int i,j,l,ans=-1,temp;

int dv(p,q){
    if(1<p&&s[0]=='0') return -1;
    if(p+1<q&&s[p]=='0') return -1;
    if(s[q]=='0'&&isdigit(s[q+1])) return -1;
    int ret=0,z;
    int t=s[p];
    s[p]=0;
    z=atoi(s);
    if(z>1e6)return-1;
    ret+=z;
    s[p]=t;
    t=s[q];
    s[q]=0;
    z=atoi(s+p);
    if(z>1e6)return-1;
    ret+=z;
    s[q]=t;
    z=atoi(s+q);
    if(z>1e6)return-1;
    ret+=z;
    //if(ret>1000000)return 0;
    //printf("%d %d %d\n",p,q,ret);
    return ret;
}

main(){
    scanf("%s",s);
    l=strlen(s);
    if(l<3&&21<l){
        puts("-1");
        return 0;
    }
    for(i=1;i<=7&&i<l;i++){
        for(j=i+1;j<=i+7&&j<l;j++){
            temp=dv(i,j);
            ans<temp?ans=temp:0;
        }
    }
    printf("%d\n",ans);
    return 0;
}


#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<limits.h>
#include<ctype.h>
char arr[25000];
int main(){
	int a,b,c,d,e;
	gets(arr);
	int i; int len=strlen(arr); int s,s1,s2; s=s1=s2=0; int max=-1;
	for(i=0;i<len-2;i++){
		for(a=i+1;a<len-1;a++){
			for(b=a+1;b<len;b++){
			s=s2=s1=0;

			int t3 = 0;
			if(arr[0]=='0'&& a!=1)
				continue;
			while(t3<a){
			s=s*10+(arr[t3]-'0');
			t3++;
			}
			if(s>1000000){
				s=0;
				continue;
			}
			int t = a;
			if(arr[t] == '0' && a+1 !=b)
				continue;

			while(t<b){
			s1=s1*10+(arr[t]-'0');
			t++;
			}
			if((s1)>1000000){
				s=s1=0;
				continue;
			}
			if(arr[b]=='0' && b!=len-1)
				continue;
			int t1=b;
			while(t1<len){
			s2=s2*10+(arr[t1]-'0');
			t1++;
			}
			if((s2)>1000000){
				s=s1=s2=0;
				continue;
			}
			if((s+s1+s2)>max){
			max=s+s1+s2;
			}
			}
	}}
	printf("%d",max);
}


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

char s[99];
int i,j,l,ans=-1,temp;

int dv(p,q){
    if(1<p&&s[0]=='0') return -1;
    if(p+1<q&&s[p]=='0') return -1;
    if(s[q]=='0'&&isdigit(s[q+1])) return -1;
    int ret=0,z;
    int t=s[p]; s[p]=0;
    z=atoi(s); s[p]=t;
    if(z>1e6)return-1; ret+=z;
    t=s[q]; s[q]=0; z=atoi(s+p); s[q]=t;
    if(z>1e6)return-1;
    ret+=z; z=atoi(s+q);
    if(z>1e6)return-1;
    ret+=z;
    //if(ret>1000000)return 0;
    //printf("%d %d %d\n",p,q,ret);
    return ret;
}

main(){
    scanf("%s",s);
    l=strlen(s);
    if(l<3||21<l){
        puts("-1");
        return 0;
    }

    for(i=1;i<=8&&i<l;i++){
        for(j=l-1;l-8<j;j--){
            if(j-i>7)continue;
            temp=dv(i,j);
            ans<temp?ans=temp:0;
        }
    }

    //printf("%d\n",dv(6,12));
    //puts(s);
    printf("%d\n",ans);
    return 0;
}


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

void mergeSort(int* a, int low, int mid, int high) {
    int p1=low, p2=mid+1, i=0, j;
    int temp[high-low+1];
    while(p1<=mid && p2<=high) {
        temp[i++] = ((a[p1] < a[p2])? a[p1++] : a[p2++]);
    }
    while(p1<=mid) {
        temp[i++] = a[p1++];
    }
    while(p2<=high) {
        temp[i++] = a[p2++];
    }
    for(j=low; j<=high; j++) {
        a[j] = temp[j - low];
    }
}

void merge(int* a, int low, int high) {
    if(low == high) return;
    int mid = (low+high)/2;
    merge(a, low, mid);
    merge(a, mi+1, high);
    mergeSort(a, low, mid, high);
}

void repeatedNumber(int* a, int* b, int m, int n) {
    int p1;
    int p2;
    for(p1=0, p2=0; p1<m, p2<n; p1++,p2++) {
        while(p1<m && p2<n) {
            if(a[p1] == b[p2]) {
                printf("%d ", a[p1]);
                p1++;
                p2++;
            } else if(a[p1] < b[p2]) {
                p1++;
            } else if(a[p1] > b[p2]) {
                p2++;
            }
        }
    }
}

int main()
{
    int m,n;
    scanf("%d %d", &n, &m);
    int a[n];
    for(int i=0; i<n; i++) {
        scanf("%d", &a[i]);
    }
    int b[m];
    for(int j=0; j<m; j++) {
        scanf("%d", &b[j]);
    }
    merge(a, 0,m-1);
    merge(b, 0, n-1);
    repeatedNumber(a, b, m-1, n-1);
    return 0;
}


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

int main()
{
    int n,m,cn=0,k, i;
    int code[20], check[20]={0};
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++) scanf("%d",&code[i]);
    for(i=1;i<=m;i++) {
        scanf("%d",&k);
        check[k]=1;
    }
    for(i=1;i<=n;i++){
        if(check[code[i]]) printf("%d ",code[i]);
    }
    return 0;

}


x=input()
seq=input().replace(" ","")
f=input()
for e in seq:
    if e in f:
        print(e,end=" ")


#include <stdio.h>

int arith_test(int,int,int,int);
int geo_test(int,int,int,int);
int main(){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(arith_test(a,b,c,d)) printf("%d",2*d-c);
    else if(geo_test(a,b,c,d)) printf("%d",d*d/c);
    else printf("42");
    return 0;
}

int arith_test(int a,int b,int c,int d){
    if(2*b==a+c && 2*c=b+d) return 1;
    else return 0;
}

int geo_test(int a,int b,int c,int d){
    if(b*b=a*c && c*c=b*d) return 1;
    else return 0;
}


#include <stdio.h>
main()
{
	int a, b, c, d;
	int prirastaj, koeficijent;
	scanf("%d%d%d%d", &a, &b, &c, &d);

	prirastaj=b-a;
	koeficijet=b/a;

	if(c==b+prirastaj && d==c+prirastaj)
		printf("%d", d+prirastaj);
	else if(c==koeficijent*b && d==koeficijent*c)
		printf("%d", koeficijent*d);
	else printf("42");

}


#include <stdio.h>

int arith_test(int,int,int,int);
int geo_test(int,int,int,int);
int main(){
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    if(arith_test(a,b,c,d)) printf("%d",2*d-c);
    else if(geo_test(a,b,c,d)) printf("%d",d*d/c);
    else printf("42");
    return 0;
}

int arith_test(int a,int b,int c,int d){
    if(2*b==a+c && 2*c=b+d) return 1;
    else return 0;
}

int geo_test(int a,int b,int c,int d){
    if(b*b==a*c && c*c==b*d) return 1;
    else return 0;
}


#include <stdio.h>
int main()
{
	int a, b, c, d;
	int prirastaj;
	float koeficijent;
	scanf("%d%d%d%d", &a, &b, &c, &d);

	prirastaj=b-a;
	koeficijent=(float)b/a;

	if(c==b+prirastaj && d==c+prirastaj)
		printf("%d", d+prirastaj);
	else if(c==koeficijent*b && d==koeficijent*c)
	{
		if(koeficijent*d==(int)(koeficijent*d))
			printf("%d", (int)(koeficijent*d));
		else printf("42");
	}
	else printf("42");

	return 0;


#include <stdio.h>
int main()
{
	int a, b, c, d;
	int prirastaj, koeficijent;
	scanf("%d%d%d%d", &a, &b, &c, &d);

	prirastaj=b-a;
	koeficijent=b/a;

	if(c==b+prirastaj && d==c+prirastaj)
		printf("%d", d+prirastaj);
	else if(c==koeficijent*b && d==koeficijent*c)
		printf("%d", koeficijent*d);
	else printf("42");

	return 1;
}


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

int daynumber(A[10])
{
    if(A[0]=='s' && A[1]=='u')
      return 0;
    else
      if(A[0]=='m')
        return 1;
    else
      if(A[0]=='t' && A[1]=='u')
        return 2;
    else
      if(A[0]=='w')
        return 3;
    else
      if(A[0]=='t' && A[1]=='h')
        return 4;
    else
      if(A[0]=='f')
        return 5;
    else
      if(A[0]=='s' && A[1]=='a')
        return 6;
}

int main()
{
    char d1[10],d2[10];
    int numd1,numd2;
    printf("give 2 days\n");
    scanf("%s %s",&d1,&d2);

    if (daynumber(d2)==(daynumber(d1)+28)%7||daynumber(d2)==(daynumber(d1)+30)%7||daynumber(d2)==(daynumber(d1)+31)%7)
        printf("yes");
    else
        printf("no");
    return 0;
}


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

int main()
{
    char day1[10],day2[10];
   // printf("Give two days:");
    scanf("%s %s",day1,day2);
    if (strstr(day1,"monday")!=NULL)
    {
      char day3[]="thursday";
      char day4[]="monday";
      char day5[]="wednesday";
    }
    else if (strstr(day1,"tuesday")!=NULL)
    {
      char day3[]="friday";
      char day4[]="tuesday";
      char day5[]="thursday";
    }
    else if (strstr(day1,"wednesday")!=NULL)
    {
       char day3[]="saturday";
        char day4[]="wednesday";
       char day5[]="friday";
    }
    else if (strstr(day1,"thursday")!=NULL)
    {
       char day3[]="sunday";
       char day4[]="thursday";
       char day5[]="saturday";
    }
    else if (strstr(day1,"friday")!=NULL)
    {
       char day3[]="monday";
       char day4[]="friday";
       char day5[]="sunday";
    }
    else if (strstr(day1,"saturday")!=NULL)
    {
       char day3[]="tuesday";
       char day4[]="saturday";
       char day5[]="monday";
    }
    else
    {
      char day3[]="wednesday";
      char day4[]="sunday";
      char day5[]="tuesday";
    }
    if (strstr(day2,day3)!=NULL || strstr(day2,day4)!=NULL || strstr(day2,day5)!=NULL)
        printf("Yes");
    else
        printf("No");
    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
 *
 */
int main() {

    int i, k=1, d1, d2, D[32];
    char D1[10], D2[10];

    //printf("Give two days of a week.\n");
    //scanf(" %c", D1);
    //scanf(" %c", D2);
    gets(D1);
    gets(D2);

    //printf("ascii %d\n", day1);

    if(strstr(D1,"monday")){
        //printf("day1=\n");
        d1=1;
    }else if(strstr(D1,"tuesday")){
        //printf("day1=2\n");
        d1=2;
    }else if(strstr(D1,"wednesday")){
        d1=3;
    }else if(strstr(D1,"thursday")){
        d1=4;
    }else if(strstr(D1,"friday")){
        d1=5;
    }else if(strstr(D1,"saturday")){
        d1=6;
    }else{
        d1=7;
    }

    if(strstr(D2,"monday")){
        d2=1;
    }else if(strstr(D2,"tuesday")){
        d2=2;
    }else if(strstr(D2,"wednesday")){
        d2=3;
    }else if(strstr(D2,"thursday")){
        d2=4;
    }else if(strstr(D2,"friday")){
        d2=5;
    }else if(strstr(D2,"saturday")){
        d2=6;
    }else{
        d2=7;
    }

    //printf("day1=%d\n",day1);
    //printf("day2=%d\n",day2);

    k=day1;
    for(i=1; i<=32; i++){
        D[i]=k;
        if(D[i]>7){
            k=1;
            D[i]=k;
        }
        k++;
    }
    /*
    for(i=1; i<=32; i++){
        printf("%d\n", D[i]);
    }
    */
    if(D[32]==d2){
        printf("YES\n");
    }else if(D[29]==d2){
        printf("YES\n");
    }else if(D[31]==d2){
        printf("YES\n");
    }else{
        printf("NO\n");
    }

    return;
}


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

int main()
{
    char day1[10],day2[10];
   // printf("Give two days:");
    scanf("%s %s",day1,day2);
    if (strstr(day1,"monday")!=NULL)
    {
      char day3[9]="thursday";
       char day4[7]="monday";
      char day5[10]="wednesday";
    }
    else if (strstr(day1,"tuesday")!=NULL)
    {
      char day3[7]="friday";
      char day4[8]="tuesday";
      char day5[9]="thursday";
    }
    else if (strstr(day1,"wednesday")!=NULL)
    {
       char day3[9]="saturday";
       char day4[10]="wednesday";
       char day5[7]="friday";
    }
    else if (strstr(day1,"thursday")!=NULL)
    {
       char day3[7]="sunday";
       char day4[9]="thursday";
       char day5[9]="saturday";
    }
    else if (strstr(day1,"friday")!=NULL)
    {
       char day3[7]="monday";
       char day4[7]="friday";
       char day5[7]="sunday";
    }
    else if (strstr(day1,"saturday")!=NULL)
    {
       char day3[8]="tuesday";
       char day4[9]="saturday";
      char day5[7]="monday";
    }
    else
    {
      char day3[10]="wednesday";
      char day4[7]="sunday";
      char day5[8]="tuesday";
    }
    if (strstr(day2,day3)!=NULL || strstr(day2,day4)!=NULL || strstr(day2,day5)!=NULL)
        printf("Yes");
    else
        printf("No");
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
	float a,x,y;
	scanf("%f%f%f",&a,&x,&y);
	if(y <= 0 )
	{
		printf("-1\n");
		exit(1);
	}
	if((int)y %(int)a == 0 )
	{
		printf("-1\n");
		exit(1);
	}
	if(y < a)
	{
		printf("1\n");
		exit(1);

	}
//	printf("etfsgtsr\n");

	int num,one;

	num = y /a;
	if (num % 2 != 0)
		one = 1 ;
	else
		one = 0;

//	printf("num = %d\n",num);
//	printf("one = %d\n",one);
	if(one == 1)
	{
		if(x <= -a/2 || x >= a/2 )
		{
			printf("-1\n");
			exit(1);
		}
	}
	if(one == 0)
	{
		if(x <= -a || x >= a || x == 0 )
		{
			printf("-1\n");
			exit(1);
		}
	}

	int count = 1;

	count = count + ((2 * (num/2)) + num  - num/2);
	if(one == 1)
		printf("%d\n",count);
	else
	{
		if(x < 0)
		{
			printf("%d\n",count-1);
		}
		else if(x > 0)
			printf("%d\n",count);
		else
			printf("-1\n");
	}

	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
	int  a,x;
	int y;
	scanf("%d%d%d",&a,&x,&y);
	if(y <= 0 )
	{
		printf("-1\n");
		exit(1);
	}
	if(y %a == 0 )
	{
		printf("-1\n");
		exit(1);
	}
	if(y < a)
	{
		printf("1\n");
		exit(1);

	}
//	printf("etfsgtsr\n");

	int num,one;

	num = y /a;
	if (num % 2 != 0)
		one = 1 ;
	else
		one = 0;

//	printf("num = %d\n",num);
//	printf("one = %d\n",one);
	if(one == 1)
	{
		if(x <= -a/2 || x >= a/2 )
		{
			printf("-1\n");
			exit(1);
		}
	}
	if(one == 0)
	{
		if(x <= -a || x >= a || x == 0 )
		{
			printf("-1\n");
			exit(1);
		}
	}

	int count = 1;

	count = count + ((2 * (num/2)) + num  - num/2);
	if(one == 1)
		printf("%d\n",count);
	else
	{
		if(x < 0)
		{
			printf("%d\n",count-1);
		}
		else if(x > 0)
			printf("%d\n",count);
		else
			printf("-1\n");
	}
	return 0;
}


#include<stdio.h>
int main()
{
  int x,y,a;
  scanf("%d %d %d",&x,&y,&a);
  float a2=(float)a/2;
  if(y%a==0)
  {
    printf("-1");
    return 0;
  }
  int ya=y/a+1;
  float xa=x/a2;
  int num=ya+(ya-1)/2;
  if(ya==1||ya%2==0)
  {
      if(xa!=0)
        printf("-1");
      else
        printf("%d",num);
       return 0;
  }
  else
 {
    if(xa>=2||xa<=-2||xa==0)
      {
         printf("-1");
         return 0;
      }
      else
      {
         if(xa>0)
            num++;
          printf("%d",num);
      }
      return 0;
 }
}


#include <stdio.h>
int main(int argc, char const *argv[]) {
  scanf("%d %d %d\n",&n,&m,&v);
  if (n==1 || m==1 || v==1) {
    printf("YES\n");
    return 0;
    /* code */
  }
  if (n==2 && m==2) {
    printf("YES\n");
    return 0;
    /* code */
  }
  if (m==2 && v==2) {
    printf("YES\n");
    return 0;
    /* code */
  }
  if (v==2 && n==2) {
    printf("YES\n");
    return 0;
    /* code */
  }
  if (m==3 && n==3 && v==3) {
    printf("YES\n");
    return 0;
    /* code */
  }
  printf("NO\n" );
  return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d"&a,&b,&c);
    int k;
    if(a<b) {k=a;a=b;b=k;}
    if(b<c) {k=b;b=c;c=k;}
    if(a<b) {k=a;a=b;b=k;}
    if(c<=3||(a==2&&b==4&&c==4) printf("YES\n");
    else printf("NO\n");
}


#include <stdio.h>
#include <stdlib.h>
int main()
{
    int a,b,c;
    scanf("%d %d %d "&a,&b,&c);
    int k;
    if(a<b) {k=a;a=b;b=k;}
    if(b<c) {k=b;b=c;c=k;}
    if(a<b) {k=a;a=b;b=k;}
    if(c<=3||(a==2&&b==4&&c==4) printf("YES\n");
    else printf("NO\n");
}


#include <stdio.h>
#include <stdlib.h>
long long min(long long x , long long y)
{ if(x>=y)
  return y;
  else
  return x ;
}
int main()
{
  long long int d , k , a, b, t ;
  scanf("%lld %lld %lld %lld %lld",&d, &k ,&a , &b, &t);
  long long int  distance_covered;
  long long int  walk ;
  long long int  car_reach ;
  if(k>=d)
  {printf("%lld\n",d*a );}
  else if( k*a + t < k*b)
  {printf("%lld\n",(d/k)*a*k + (d/k-1)*t + min(d%k*a + t, d%k*b));}
  else
  {printf("%lld\n",a*k+(d-k)*b );}
return 0;
}


#include "stdbool.h"
#include "stdio.h"
#include "stdint.h"
#include "string.h"
#include "ctype.h"
#include "stdlib.h"
#include "math.h"

#define PI 3.14159265358979323846264338327950288
#define ll long long
#define MOD 1000000007
#define N 300001
#define MAX1 101

int max(int a,int b) {return a>b?a:b;}
int min(int a,int b) {return a<b?a:b;}
ll minl(ll a,ll b) {return a<b?a:b;}
ll maxl(ll a,ll b) {return a>b?a:b;}

ll d,k,a,b,t,ans;

int main() {
    scanf("%lld %lld %lld %lld %lld", &d, &k, &a, &b, &t);
    ll firstStep = minl(d,k);
    d -= firstStep;
    ans = a * firstStep;
    if (d >= k) {
        ll z = minl(t + a*k, b*k);
        ans += (d/k) * z;
        d %= k;
    }
    printf("%lld\n", ans + minl(t + a*d, b*d));
}


#include<stdio.h>
int main()
{   unsigned long long int d,dleft,time=0,a,b,k,t;
    scanf("%I64u%I64u%I64u%I64u%I64u",&d,&k,&a,&b,&t);dleft=d;
    if(d<=k)
    time=d*a;
	if(d>k){
			time=a*k;dleft=d-k;
		    if(t+a*k<b*k){
			time = time + ((dleft/k)*k*a) + ((dleft/k)*t);
			dleft=dleft%k;
			if( (dleft*a)+t < (dleft*b) ){
			time=time + t+ dleft*a;}
			else{
				time= time + (dleft*b);
			}

			}
			else{
				time= time + (dleft*b);
			}		}
			printf("%I64u",time);

	return 0;
}


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

    unsigned long long int a,b,c,d,e,f,i,j,n,tc,th,tb,s;
    scanf("%llu%llu%llu%llu%llu",&a,&b,&c,&d,&e);
     if(b>a)
   {tc=a*c;
      a=0;}
    else if(a>=b)
    {a=a-b;
    tc=b*c;}
    if(a!=0)
    {
        th=a%b;
        tb=a-th;
        s=a/b;

    if(e+b*c>=b*d)
        {
            tc=tc+a*d;

        }
        else
        {
            i=tc+s*e+tb*c+e+(a-tb)*c;
         tc=tc+s*e+tb*c+(a-tb)*d;
            if(i<tc)
            tc=i;

        }
    }

    printf("%llu",tc);

return 0;

}


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

int main()
{
   long long d,k,a,b,t,m1,result;
   scanf("%lli%lli%lli%lli%lli",&d,&k,&a,&b,&t);
if( d <=k){
    result = d*a;}
    else{
   if(k*a+t < b*k){
      m1=d/k;
      if ( (d - m1*k)*a+t< (d-m1*k)*b ) {
        result = d*a+m1*t;}
    else
        result = m1*a*k + (m1-1)*t + (d-m1*k)*b;
    }
    else result = a*k+(d-k)*b;}

    printf("%lli", result);
    return 0;
}


#include<stdio.h>
#include<math.h>
int black(int *,int);
int white(int *,int);
int main()
{
    int n,arr[100],i;
      scanf("%d",&n);

      int pos;
    for(i=0;i<n;i++)
        arr[i]=0;
    for(i=0;i<n/2-1;i++)
      {
          scanf("%d",&n);
          arr[n]=1;
       }
     int bl=black(arr,n);
     int wh=white(arr,n);
     (black>white)?printf("%d",black):printf("%d",white);

     return 0;
}
int black(int *arr,int n)
{
    int i=n-1,j=n-2,steps=0;
    while(i>=0 &&j>=0)
    {
        if(arr[i]==1 && i/%2==1)
          {
            if(arr[j]==0)
            {
             arr[j]=1;
             arr[i]=0;

             steps+=abs(j-i);
             i--;
             j-=2;
            }
           else
           {
               while(arr[j]!=0)
               j-=2;

             arr[j]=1;
             arr[i]=0;

             steps+=abs(j-i);
             i--;
             j-=2;

           }
        }
        else if(arr[i]==1 && i%2==0)
           i--;
    }
}
int white(int *arr,int n)
{
    int i=n-1,j=n-1,steps=0;
    while(i>=0 && j>=1)
    {
        if(arr[i]==1 && i/%2==1)
          {
            if(arr[j]==0)
            {
             arr[j]=1;
             arr[i]=0;

             steps+=abs(j-i);
             i--;
             j-=2;
            }
           else
           {
               while(arr[j]!=0)
               j-=2;

             arr[j]=1;
             arr[i]=0;

             steps+=abs(j-i);
             i--;
             j-=2;

           }
        }
        else if(arr[i]==1 && i%2==0)
           i--;
    }
}


#include<stdio.h>
#include<math.h>
int main()
{
    int n,arr[100],i;
      scanf("%d",&n);

      int pos;
    for(i=0;i<n;i++)
        arr[i]=0;
    for(i=0;i<n/2-1;i++)
      {
          scanf("%d",&n);
          a[n]=1;
       }
     int black=black(arr,n);
     int white=white(arr,n);
     (black>white)?printf("%d",black):printf("%d",white);

     return 0;
}
int black(int *arr,int n)
{
    int i=n-1,j=n-2,steps=0;
    while(i>=0)
    {
        if(arr[i]==1 && i/%2==1)
          {
            if(arr[j]==0)
            {
             arr[j]=1;
             arr[i]=0;

             steps+=abs(j-i);
             i--;
             j-=2;
            }
           else
           {
               while(arr[j]!=0)
               j-=2;

             arr[j]=1;
             arr[i]=0;

             steps+=abs(j-i);
             i--;
             j-=2;

           }
        }
        else if(arr[i]==1 && i%2==0)
           i--;
    }
}


#include <stdio.h>
#include<stdlib.h>
#include<algorithm>
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	char a[109];
	for(int i=1;i<=n/2;i++){
		scanf("%d",&a[i]);
	}
	sort(a+1,a+1+n/2);
	int sum1=0,sum2=0;
	for(int i=1;i<=n/2;i++){
		sum1+=abs(a[i]-(i*2-1));
		sum2+=abs(a[i]-(i*2));
	}
	printf("%d",sum1<sum2? sum1:sum2);

}


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

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

int main(int argc, char *argv[]) {
	int k1 ,k2 ,N1 , N2 ;
	if (N1>N2)
	{printf ("le joeur 1 gagne ");
	 }
	 else { printf ("le joeur 2 gagne  ")
	 }
	return 0;
}


#include<stdio.h>
int main(){
    int i,j,k,l;
    scanf("%d %d %d %d", &i,&j,&k,&l);
    if(i<=j){
    	printf("second");

	  } else{
    else
	    printf("first");

    }

    return 0;

}


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

	int n1,n2,k1,k2;
	scanf("%d%d%d%d",&n1,&n2,&k1,&k2);
	int a1,a2;
	a1=n1-k1;
	a2=n2-k2;
	k=k1-k2;
	if(a1>a2&&k>0)
    {
        printf("Second");
    }
    else
        printf("First");
	return 0;
}


#include<stdio.h>
int main(){
int n1,n2,k1,k2;
scanf("%d %d %d %d",&n1,&n2,&k1,&k2);
if(n1>n2)
printf("First\n");
else
printf(Second\n");
return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int b1,b2,m1,m2;
    for(int i=0; i<5; i++)
    {
        cin>>b1>>b2>>m1>>m2;
        if(m1<=b1&&m2<=b2)
        {
            if(m1==m2&&b2>b1)cout<<"second";
            else if(m1==m2&&b1>b2)cout<<"first";
            else if(m1==m2&&b1==b2)continue;
            else if(m1>m2&&b1>=b2)cout<<"first";
            else if(m1>m2&&b2-m2>=b1-m1)cout<<"second";
            else if(m2>m1&&b2>=b1)cout<<"second";
            else if(m2>m1&&b1-m1>=b2-m2)cout<<"first";
            else continue;
        }
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define LL long long
#define me(x) memset(x,0,sizeof(x))
long n,m,k;
LL max(LL x,LL y)
{
	return x>y?x:y;
}
long d[100005],tot=0;
int main()
{
	long i,t;
	LL ans=0;
	scanf("%ld %ld %ld",&n,&m,&k);
	k+=2;
	if (k>m+n){printf("-1"); return 0;}
	t=(long)sqrt(m+0.1);
	for (i=1;i<=t;i++) {d[++tot]=i; d[++tot]=m/i;}
	t=(long)sqrt(n+0.1);
	for (i=1;i<=t;i++) {d[++tot]=k-i; d[++tot]=k-n/i;}
	for (i=1;i<=tot;i++) if (d[i]>0&&d[i]<k) ans=max(ans,(LL)(m/d[i])*(n/(k-d[i])));
	printf("%I64d",ans);
	return 0;
}


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

	}
}


#include<stdio.h>
long long int n,m,k,i,j,k,t;
long long int ans(long long int a,long long int b)
{
    long long int x = n*m;
    long long int y = (a+1)*(b+1);
    return x/y;
}
int main()
{
    scanf("%lld%lld%lld",&n,&m,&k);
    if(n>m)
    {
        t=n;
        n=m;
        m=t;
    }
    else
    {

    }
    if(k>n+m-2)
        printf("-1\n");
    else if(k<n)
    {
        printf("%lld\n",ans(k,0));
    }
    else if(k>=n && k<m)
    {
        printf("%lld\n",ans(0,k));
    }
    else
    {
        printf("%lld\n",ans(k+1-m,m-1));
    }
}


#include<stdio.h>
int main()
{
    long int n,m,k,temp;
    scanf("%ld",&n);
    scanf("%ld",&m);
    scanf("%ld",&k);

    if(m<n)
    {
        temp=m;
        m=n;
        n=temp;
    }
    if(k>m+n-2)
    printf("-1");
    else if(k<=m+n-2)
    {
        if(k<m)
        printf("%ld",(n*(m/(k+1)));
        else if(k>=m)
        printf("%ld",n/(k-m+2));
    }
return 0;
}


#include "stdio.h"
int main()
{
	_int64 s,x,n,m,k,c;
	scanf ("%I64d %I64d %I64d",&n,&m,&c);k=c+1;//������ѵ һ�ǵ��⼸����Ҫע�� һ��������� K=c+1 �����ܷ����Ӧ���ǿ�k%m�Ƿ������
	x=m*n;// �������ѵ�Ǿ���ĳ������Ϊ������ Ҳ����������������� ����ȫ������Ϊ������
	if (c>n+m-2)
		printf ("-1");
	else if (m%k==0||n%k==0)
		printf ("%I64d",s=x/k);
	else if (c<m&&c<n)
		printf ("%I64d",s=(m/k*n>n/k*m?m/k*n:n/k*m));
	else if (k>m&&k>n)
		printf ("%I64d",s=(m/(k+1-n)>n/(k+1-m)?m/(k+1-n):n/(k+1-m)));
	else if (k<m)
		printf ("%I64d",s=(m/(k+1-n)>m/k*n?m/(k+1-n):m/k*n));
	else
		printf ("%I64d",s=(n/(k+1-m)>n/k*m?n/(k+1-m):n/k*m));
	printf ("\n");
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
  int n;
  scanf("%d",&n);
  int arr[n];
  for(int i=0;i<n;i++)
  {
    scanf("%d",&arr[i]);
  }
  int i1=0,i2=0;
  int max=arr[0],min=arr[0];
 for(int i=0;i<n;i++)
 {
  if(arr[i]>max)
  {
    max=arr[i];
  }
 }
 for(int i=0;i<n;i++)
 {
  if(arr[i]==max)
  {
    i1=i;
  }
 }
  for(int i=0;i<n;i++)
 {
  if(arr[i]<min)
  {
    min=arr[i];
  }
 }
 for(int i=0;i<n;i++)
 {
  if(arr[i]==min)
  {
    i2=i;
  }
 }

 int h[4];
 h[0]=abs(i2-0);
 h[1]=abs(i2-(n-1));
 h[2]=abs(i1-0);
 h[3]=abs(i1-(n-1));
 int max1=-9999;
 for(i=0;i<4;i++)
{
if(h[i]>max1)
{
  max1=h[i];
}
}

printf("%d",max1);
}


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

int m (int a,int b){
	if (a>b)
	  return a;
	else
	  return b;
}

int main (){
	int i,n,max,min,m,maxi=0,mini=0,a[101];

	scanf ("%d",&n);
	scanf ("%d",&max);
	a [0]=min=max;
	for (i=1;i <n;i++){
		scanf ("%d",&a [i]);
		if (a [i]>max){
           max=a[i];
		   maxi=i;
		}
	   else if (a [i]<min){
	        mini=i;
	        min=a [i];
	    }
	}

	int x=abs (maxi-mini);
	int y=abs (maxi-n-1);
	int z=abs (mini-n-1);
	i= m(x,maxi);
    int j=m (y,z);
	int ans=m (m (i,j),mini);
	 printf ("%d",ans);
}


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


#include<stdio.h>
void main()
{
	int n, i, vmin, vmax,min,max, a[101];
	scanf_s("%d", &n);
	min = n + 1; max = -1;
	for (i = 0; i < n; i++)
	{
		scanf_s("%d", &a[i]);
		if (a[i] > max)
		{
			max = a[i];
			vmax = i;
		}
		if (a[i] < min)
		{
			min = a[i];
			vmin = i;
		}
	}
	if (vmin < n - vmin) vmin = n - vmin;
	if (vmax < n - vmax) vmax = n - vmax;
	if (vmin > vmax)printf("%d", vmin-1);
	else printf("%d", vmax-1);
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int x = 0, a = 0, ans = 0;
		char b = 'E', t = 'E';
		x = in.nextInt();
		if (x % 4 == 1) {
			System.out.println("0 A");
		} else {
			for (a = 0; a <= 2; a++) {
				if ((x + a) % 4 == 1) {
					t = 'A';
				} else if ((x + a) % 4 == 3) {
					t = 'B';
				} else if ((x + a) % 3 == 2) {
					t = 'C';
				} else if ((x + a) % 4 == 0) {
					t = 'D';
				}
				if (t - b < 0) {
					b = t;
					ans = a;
				}
			}
			System.out.println(ans + " " + b);
		}
		in.close();
	}

}


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

 int main()

 {
     int x;
     printf("enter the current HP\n");
     scanf("%d",&x);

     if (x%4==1)
     flag=1;

     else if(x%4==3)
     flag=2;

     else if(x%4==2)
     flag=3;

     else
     flag=4;

     if (flag==1)
     {
        printf("0 A");
     }

     else if (flag==2)
     {
        printf("2 A");
     }

     else if (flag==3)
     {
         printf("1 B");
     }

     else if (flag==4)
     {
          printf("1 A");
     }
      return 0;

 }

 }


#include<stdio.h>
#include<conio.h>
main()
{
   int n,b,c;
   scanf("%d",&n);
   b=n%4;8
   if(b==1)
   {
       printf("0 A");
   }
   else
     {
      if(b==2)
      {
          printf("1 B");
      }
      else
        if(b==3)
         {
            printf("2 A");
         }
         else
            printf("2 B");
      }

   }


#include <stdio.h>

int main(){
	int n,k,path;
	scanf("%d %d",&n,&k);
	if(n==1){
	    print(0);
	}
	else{
	if((n-k)<=(k-1)){
		path=(n-k)+(n-1);
	}
	else{
		path=(n-1)+(k-1);
	}
	int total=2*path+n+2;
	if(k!=1 && k!=n){
		total -= 1;
	}
	printf("%d",total);
	}
}


#include<stdio.h>
int main()
{
	int n,k,total,median;
	scanf("%d %d",&n,&k);
	total = (n - 1) * 2 + 3;
	(n % 2 == 0) ? median = n / 2 : median = n/2+1;
	if(k == 1 || k == n)
	{
		printf("%d\n",total + n - 1);
	}
	else{
		if(n % 2 == 0)
		{
			if(k == median || k == median + 1)
			{
				k = (median - 1) * 2 + n/2;
				printf("%d\n",total+ k);
			}
			else{
				int temp = median + (median+1);
				if(k < median)
				{
					total += (k-1) * 2 + (n - k);
					printf("%d\n",total);
				}
				else if(k > median)
				{
					k = temp % k;
					total += (k-1) * 2 + (n - k);
					printf("%d\n",total);
				}
			}
		}
		else if(n % 2 != 0)
		{
			if(k == median)
			{
				k = n-1;
				printf("%d\n",total + k + n/2);
			}
			else{
				if(k < median)
				{
					printf("%d\n",total + (k-1) * 2 + (n - k));
				}
				else{
					k =  k % (median * 2);
					printf("%d\n",total + (k-1) * 2 + (n-k));
				}
			}
		}
	}
	return 0;
}


#include <stdio.h>

int main()
{

int n,pos,ans;

scanf("%d",&n);

scanf("%d",&pos);

if(pos>n/2)
ans=n+n+1+2*(n-k)+(k-1);

else
ans=n+n+1+2*(k-1)+(n-k);

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


#include<stdio.h>
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    if(k==1)
    printf("%d\n",3*(n-k+1));
    else if(k==2)
     printf("%d",3*(n-k+1)+4);
     else if(k>n/2)
     printf("%d",4*n-k;
    else
     {
             printf("%d",3*n+k-1);

     }

}


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

  int main() {
  char num[100];
  long long int limit, p = 0, q = 1, ans;
  int i, len, j, r;
  scanf("%s", num);
  scanf("%lld", &limit);
  len = strlen(num);
  for(i = len-1 ; i >= 0; i--, q *= 10) {
      if(num[i] == '9')
          continue;
          p = q*(num[i] - 47);
          if(p > limit)
             break;
          limit -= p;
          j = i;
          num[i] = '9';
          while(j-- >= 0) {
             if(num[j] != '0') {
                num[j]--;
                break;
             }
                num[j] = '9';

          }
  }
  sscanf(num, "%lld", &ans);
  printf("%lld\n", ans);
  return 0;
  }


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

int main()
{
   int val(char t[25]);
   char ans[25],t1[25],t2[25]={'0'};
   long long a,b,ta;
   int i,j,k,lt,now,str;
   now=0;
   scanf("%I64d %I64d",&a,&b);
   b=a-b; lt=0; ta=a;
   while (ta!=0)
   {
     t1[lt++]=ta % 10;
     ta=ta /10;
   }
   t1[lt+1]='\0';
   while (1)
   {
     strcpy(t2,t1);
     for (i=0;i<=now;i++)
       t2[i]='9';
     while (val(t2)>=a)
        if (t2[now+1]>'0') t2[now+1]--;
         else break;
     if ((val(t2)<a) && (val(t2)>b)) strcpy(ans,t2);
         else break;
     now++;
   }
   if (now==0)  printf("%I64d",a);
       else     printf("%I64d",val(ans));
}
long long val(char t[25])
{
   int i,lt,tt,ans;
   tt=1;
   ans=0;
   for (i=0;i<=strlen(t);i++)
   {
    ans=ans+(t[i]-'0')*tt;
    tt=tt*10;
   }
   return ans;
}


#include<stdio.h>

int main(){
    long long p, d, i, m = 0;
    scanf("%I64d%I64d", &p, &d);
    if (p < 10)printf("%I64d\n", p);
    else {
         for (i = 10 ; i <= p ; i *= 10){
             if (p % i + 1 <= d)
                m = p % i + 1;
             else break;
         }
         printf("%I64d\n", p - m);
    }
    scanf(" ");
    return 0;
}


#include <stdio.h>

int num_digits(long long x);

int main(void)
{
    long long p, d;
    scanf("%I64d %I64d", &p, &d);

    int s = 1, q = 0;
    long long p2 = p;

    while (d > 0)
    {
        q = ((p2 % 10) + 1) * s;
        s *= 10;

        if (num_digits(q) == num_digits(p) || d < q || q >= p)
            break;

        if (q != s)
        {
            p = p-q;
            d = d-q;
        }
        p2 = p/s;
    }

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

int num_digits(long long x)
{
    if (x % 10 == x)
        return 1;
    return 1 + num_digits(x / 10);
}


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

int main()
{
   //char ans[25],t1[25],t2[25]={'0'};
   long long val(char t[25]);
   long long a,b,ta,t1,ans;
   long long bit[18],nine[18];
   int i,j,k,lt,now,str;
   now=0;
   scanf("%I64d %I64d",&a,&b);
   b=a-b; lt=0;
   bit[0]=1; nine[0]=9;
   for (i=1;i<=17;i++)
    {bit[i]=bit[i-1]*10; nine[i]=nine[i-1]*10+9;}
   while (1)
   {
     t1=a;
     t1=t1-(t1 % bit[now+1])+nine[now];
     while (t1>=a)
        t1=t1-bit[now+1];
     if ((t1<a) && (t1>b)) ans=t1;
       else break;
     now++;
   }
   if (now==0)  printf("%I64d",a);
       else     printf("%I64d",ans);
}


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

#define maxN 1000001

bool isP[maxN];
int ps[maxN];

bool isPrime( int n ) {
	int i;

	for( i = 2; (long long) i * i <= n; i++ )
		if( n % i == 0 ) return false;

	return true;
}

int main( void ) {
	int i, j, c;

	isP[2] = isP[3] = isP[5] = 1;

	for( i = 7; i < maxN; i += 2 )
		if( isPrime(i) ) isP[i] = 1;

	ps[0] = 0;
	for( i = 1; i < maxN; i++ )
		ps[i] = ps[i-1] + isP[i];

	int a, b, k;
	scanf("%i %i %i", &a, &b, &k);

	int lo = 0, hi = b, ans = -1, mid;
	while( lo <= hi ) {
		mid = (lo + hi) / 2;

		if( b - mid + 1 < a ) break;

		int cnt = ps[a+mid-1] - ps[a-1];

		bool ok = 1;
		if( cnt < k ) ok = 0;

		for( i = a+1; i <= b-mid+1; i++ )
			if( ps[i+mid-1] - ps[i-1] < k ) ok = 0;

		if( ok ) {
			ans = mid;
			hi = mid - 1;
		} else lo = mid + 1;

	}

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

	return 0;
}


#include <stdio.h>

#define MAXN 1000001

char Flag[MAXN];
int  Prime[79000];
int  Cnt;

void Make()
{
    int i,j;
    for(Cnt=0,i=2; i<MAXN; ++i)
    {
        if(!Flag[i])
        {
            Prime[Cnt++]=i;
            for(j=i<<1; j<MAXN; j+=i)
            {
                Flag[j]=1;
            }
        }
    }
    return;
}

int Binary(int key)
{
    int Left,Mid,Right;
    Left=0;
    Right=Cnt;
    while(Right>=Left)
    {
        Mid=(Left+Right)/2;
        if(Prime[Mid]==key)
        {
            return Mid;
        }
        else if(Prime[Mid]<key)
        {
            Left=Mid+1;
        }
        else
        {
            Right=Mid-1;
        }
    }
    return Left;
}

int main()
{
    int A,B,K,i,Max,temp;
    Make();
    scanf("%d %d %d",&A,&B,&K);
    for(Max=0,i=A; Prime[Binary(i)+K-1]<=B; ++i)
    {
        temp=Prime[Binary(i)+K-1]-i+1;
        if(temp>Max)
        {
            Max=temp;
        }
    }
    temp=Binary(B);
    if(B==Prime[temp])
    {
        --K;
    }
    temp=Prime[temp-K];
    temp=B-temp+1;
    if(temp>Max)
    {
        Max=temp;
    }
    if(Max>B-A+1)
    {
        puts("-1");
    }
    else
    {
        printf("%d\n",Max);
    }
    return 0;
}


#include <stdio.h>

#define MAXN 1000001

char Flag[MAXN];
int  Prime[79000];
int  Cnt;

void Make()
{
    int i,j;
    for(Cnt=0,i=2; i<MAXN; ++i)
    {
        if(!Flag[i])
        {
            Prime[Cnt++]=i;
            for(j=i<<1; j<MAXN; j+=i)
            {
                Flag[j]=1;
            }
        }
    }
    return;
}

int Binary(int key)
{
    int Left,Mid,Right;
    Left=0;
    Right=Cnt;
    while(Right>=Left)
    {
        Mid=(Left+Right)/2;
        if(Prime[Mid]==key)
        {
            return Mid;
        }
        else if(Prime[Mid]<key)
        {
            Left=Mid+1;
        }
        else
        {
            Right=Mid-1;
        }
    }
    return Left;
}

int main()
{
    int A,B,K,i,Max,temp;
    Make();
    while(scanf("%d %d %d",&A,&B,&K)!=EOF)
    {
        for(Max=0,i=A; Prime[Binary(i)+K-1]<=B; ++i)
        {
            temp=Prime[Binary(i)+K-1]-i+1;
            if(temp>Max)
            {
                Max=temp;
            }
        }
        temp=Binary(B);
        if(B==Prime[temp])
        {
            --K;
        }
        temp=Prime[temp-K];
        temp=B-temp+1;
        if(temp>Max)
        {
            Max=temp;
        }
        if(Max>B-A+1)
        {
            puts("-1");
        }
        else
        {
            printf("%d\n",Max);
        }
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
int p[100000001];
void isPrime(int n)
{
	int i,j,prime;

	p[0] = 0;
	p[1] = 0;

	for(i=2;i*i<=n;i++)
	{
		if(p[i] == 1)
		{
			for(j=i*2;j<=n;j+=i)
			{
			p[j] = 0;
			}
		}
	}
}

int check_prime(int a,int b,int l,int k)
   {

int c = 0;
   isPrime(b);

   for(int i=a;i<=a+l-1;i++)
   {
   	if(p[i] == 1)
   	{
   	c++;
   	}

   }
if(c<k)
	return 0;

int i=a,j=a+l-1;
while(j<b)
{
	if(p[i]==1)
		c--;
	i++;
	j++;

	if(p[j]==1)
		c++;

	if(c<k)
          return 0;

}

if(c<k)
{
	return	0;
}
return 1;
}

int main()
{
	int i,j,k,l,a,b;
	int s,e;
	int r,n,q = -1;
	scanf("%d %d %d", &a,&b,&k);
	for(i=0;i<=b;i++)
	{
		p[i] = 1;
	}
	s = 1;
	e = b - a + 1;
	while(s<=e)
	{
		l = (s+e)/2;
		r = check_prime(a,b,l,k);
		if(r == 0)
		{
			s = l+1;
		}
		if(r == 1)
		{
			q = l;
			e = l-1;
		}
	}
		printf("%d\n",q);

	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int main(){
    unsigned short t;
    cin >> t;
    while(t--){
        unsigned short n;
        cin >> n;
        cout << (int)pow(2,n)-1 << endl;
    }
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<cmath>
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int *a=(int*)malloc(sizeof(int)*n);
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<n;i++)
	cout<<pow(2,a[i])-1<<endl;
	return 0;
 }


#include <stdio.h>

int main()
{
	int n;
	scanf("%d",&n);
	while(n--)
	{
		int num;
		scnaf("%d",&num);
		num = 1 << num;
		num--;
		printf("%d\n",num);

	}

}


#include<stdio.h>
int main()
{
	int t;
	scanf_s("%d", &t);
	while (t--) {
		int n;
		long int sum = 2;
		scanf_s("%d", &n);
		for (int i = 2;i <= n;i++) {
			sum *= 2;
		}
		printf("%d", sum - 1);
	}
	return 0;
}


#include <iostream>
#include <cmath>
using namespace std;

int ans(unsigned int n){
    return (int)pow(2,n)-1;
}

int main(){
    unsigned short t;
    cin >> t;
    while(t--){
        unsigned short n;
        cin >> n;
        cout << ans(n) << endl;
    }
    return 0;
}


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

int main()
{
    char *original=NULL, *received=NULL;
    size_t org_size;
    int length;
    getline(&original, &org_size, stdin);
    getline(&received, &org_size, stdin);
    length = strlen(received);
    int final=0, sure=0, doubts=0;
    int i,j,k;

    for(i=0; i<length; i++)
    {
        if(original[i] == '+') final++;
        else if(original[i] == '-') final--;
        else break;
        if(received[i] == '+') sure++;
        else if (received[i] == '-') sure--;
        else doubts++;
    }
    int plus = final - sure;
    if (plus < 0) plus = doubts - plus;
    if(((plus == 0) && (doubts%2 != 0)) || plus > doubts){
            printf("0.000000000000\n");
            return 0;
    }
    if (plus == 0) plus = doubts/2;
    int num = 1;
    int deno = 1;
    for(i=0; i<plus; i++)
    {
        num = num*(doubts - i);
        deno = deno*(plus - i);
    }
    for(i=0;i<doubts;i++) deno = deno*2;
    printf("%.12f\n", (float)(num)/(float)(deno));
    return 0;
}