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


#include<stdio.h>

int main(){
 int a,b,c,sum,min,k;
 scanf("%d %d %d", &a,&b,&c);
 sum=0;
 k=0;
 while (k!=1)
  {if (((c-1)<=b)&&((c-2)<=a))
 	 {
		sum= 3*c-3;
		k=1;
 	 }
  else
	 {
		c=c-1;
 	 }
  }
 printf("%d",sum);
 return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int compare (const void * a, const void * b)
{
  return ( *(int*)a - *(int*)b );
}
int main()
{
    int a=0,b=0,n,i,t,val1=0,val2=0,ch=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&t);
        if(t==100)
        a=a+1;
        else
        b=b+1;
    }
    val1=b/2;
    val2=b-val1;
    if(val1==val2)
    {
        if(a%2==0)
        printf("YES");
        else
        printf("NO");
    }
    else
    {
        if((a>=2)&&(a%2==0))
        printf("YES");
        else
        printf("NO");
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
	{int x,y,i,j;
	 char a[102],b[102];
	int c[102];

 	scanf("%s",a);
        scanf("%s",b);
        j=strlen(a);

        for(i=0;i<j;i++)
		{if(a[i]==b[i])
			c[i]=0;
		else
			c[i]=1;
		}
	for(i=0;i<j;i++)
	printf("%d",c[i]);

	}


#include <stdio.h>

int main (void){
    int n,k,j,h;    //n:nro de examenes; k:sumatoria de puntajes

    scanf("%d %d",&n,&k);
    j= n*2;
    h= 0;
    if(j>k){
        j=0;
        printf("%d", j);
    }else if (j<k){
        while(j<k){
            j++;
            n--;
        }
        if(n>0){
            printf("%d", n);
        }else{
            j=0;
            printf("%d", j);
        }
    }else{
        printf("%d", n);
    }
    return 0;
}


#include <stdio.h>
int main() {
    int a, b, c, d, x, y, i, j;
    scanf("%d%d%d%d", &a,&b,&c,&d);
    int max = a;
    if(c<max)
        max = c;
    if(d<max)
        max = d;

    x = 256*max;

    a = a - max;
    c = c - max;
    d = d - max;

    max = a;
    if(b<max)
        max = b;

    x = x + 32*max;

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


#include<stdio.h>
int main()
{
int n,x,v;
scanf("%d",&v);
n=v;
x=n-1;
while((x<n)&&(x>0))
{
if((n%x)!=0)
{
n=n-x;
}
x--;
}

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


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

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

long long int min(long long int a, long long int b)
{
	if(a<b)
		return a;
	return b;
}

long long int max(long long int a, long long int b)
{
	if(a>b)
		return a;
	return b;
}

int main()
{
	long long int n,a,b,c,d;
	long long int ans=0,i,p,q,r,s,t,u,v,w,y;
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	q=c+a;
	r=c+d;
	s=b+d;
	for(i=1;i<=n;i++)
	{
		p=a+b+i;
		t=p-q;
		u=p-r;
		v=p-s;
		w = min(t,min(u,v));
		y = max(t,max(u,v));

		if(w>=1 && y<=n)
		{
			ans+=n;
		}

	}
	printf("%lld\n",ans );

	return 0;
}


#include<stdio.h>

int main()
{
	int x,y,i,b;
	long long int a=1;
	scanf("%d %d",&x,&y);
	if(x>y){
		b=x;
		x=y;
		y=b;
	}
	for(i=1;i<=x;i++){
		a=i*a;
	}
	printf("%lld",a);
	return 0;
}


#include <stdio.h>

 int main(){
 long long A,B,g,y,BALL;

 scanf("%lld %lld",&A,&B);
 scanf("%lld %lld %lld",&y,&g,&BALL);
 A=A-(y*2+g);
 B=B-(BALL*3+g);
 if ((A)>=0)
      A=0;
 else A=-A;
 if ((B)>0)
     B=0;
 else B=-B;
 printf("%lld", A+B);

 return 0;

}


#include <stdio.h>

#define MAX 200010
#define MOD 1000000007

int n, m, h, sum[1010], dp[MAX][2];

void Pregenerate(){
    int i, j, l, res, x = 0;
    for (i = h; i >= 0; i--){
        sum[i] = x;
        x += i;
    }

    for (l = 0; l <= h; l++){
        for (i = n; i >= 0; i--){
            j = sum[l] - i;
            if (i > sum[l]) continue;
            if (j > m) continue;

            if (!l) res = 1;
            else{
                res = 0;
                if ((i + l) <= n) res = res + dp[i + l][(l - 1) & 1];
                if ((j + l) <= m) res = res + dp[i][(l - 1) & 1];
            }

            if (res >= MOD) res -= MOD;
            dp[i][l & 1] = res;
        }
    }
}

int main(){
    int i, j;

    while (scanf("%d %d", &n, &m) != EOF){
        for (h = 0; h <= 1000; h++){
            int x = (h * (h + 1)) >> 1;
            if (x > (n + m)){
                h--;
                break;
            }
        }

        Pregenerate();
        int res = dp[0][h & 1];
        printf("%d\n", res);
    }
    return 0;
}


#include<stdio.h>
int main() {
	int M,N,min,max;
	scanf("%d%d",&N,&M);
	if(M==0 && N==0)
		printf("0 0\n");
	else if(N==0)
		printf("Impossible\n");
	else {
		if(M==0) {
			min=N;
			max=N;
		}
		else {
			if(N>=M) {
				min=N;
				max=N+M-1;
			}
			else {
				min=M;
				max=N+M-1;
			}
		}
		printf("%d %d\n",min,max);
	}
	return 0;
}


#include <stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        int key, doors[3], i;
        scanf("%d", &key);
        scanf("%d %d %d", &doors[0], &doors[1], &doors[2]);
        for (i = 0; i < 3; i++)
        {
            int index = key;
            if (doors[index - 1] == 0)
            {
                if (i == 2)
                    printf("YES\n");
                else
                    printf("NO\n");
                break;
            }
            else if (doors[index - 1] == 1)
                key = 1;
            else if (doors[index - 1] == 2)
                key = 2;
            else
                key = 3;
        }
    }
}


/* Problem: 415A - Mashmokh and Lights */
/* Solver: Gusztav Szmolik */

#include <stdio.h>

int main ()
    {
    unsigned short n;
    unsigned short m;
    unsigned short i;
    unsigned short l[100];
    unsigned short b;
    unsigned short j;

    if (scanf("%hu %hu",&n,&m) != 2)
        return -1;
    if (n < 1 || n > 100 || m < 1 || m > 100)
        return -1;
    for (i = 0; i < n; i++)
        l[i] = 0;
    for (i = 0; i < m; i++)
        {
        if (scanf("%hu",&b) != 1)
            return -1;
        if (b < 1 || b > n)
            return -1;
        for (j = b-1; j < n && !l[j]; j++)
            l[j] = b;
        }
    if (!l[0])
        return -1;
    for (i = 0; i < n; i++)
        printf ((i ? " %hu" : "%hu"),l[i]);
    printf ("\n");
    return 0;
    }


#include<stdio.h>
int main()
{
    int n,j,p;
    scanf("%d",&n);
    char a1[n];
    scanf("%s",a1);
    p=strlen(a1);
    int c=0,d=0;
    for(j=0;j<p;j++)
    {
        if(a1[j]=='8')
        {
            c=1;
            d++;
        }
    }
    if(c==1)
    {
        if(d <= n/11)
        printf("%d\n",d);
        else
            printf("%d\n",n/11);
    }
    else
        printf("0\n");
    return 0;
}


#include <stdio.h>
int main() {
    int l, r, a, ans;
    scanf("%d%d%d", &l, &r, &a);
    int delta = (l > r) ? l - r : r - l;
    if (delta > a) {
        if (l > r) {
            ans = r + a;
        } else {
            ans = l + a;
        }
    } else {
        a -= delta;
        a /= 2;
        if (l > r) {
            ans = l + a;
        } else {
            ans = r + a;
        }
    }
    printf("%d\n", 2 * ans);

    return 0;
}


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

int main(void){
    int count[1001] = {0};      //sorts the f array
    int n, m, *f, i, j, min;

    scanf(" %d %d", &n, &m);

    f = (int*)malloc(m*sizeof(int));

    for(i=0; i<m; scanf(" %d", &f[i]), count[f[i]]++, i++)
        ;

    j = 0;

    for(i=0; i<1001; i++){
        for(; count[i]>0; f[j]=i, count[i]--, j++)
            ;
    }

    min = f[n-1] - f[0];

    for(i=1; i<=(m-n); i++)
        if((f[n+i-1] - f[i]) < min)
            min = (f[n+i-1] - f[i]);

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

    return 0;
}


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

    for(i=0;i<n;i++){
            scanf("%d",&arr[i]);
            sum+=arr[i];
    }
    if(t-sum>=10*(n-1)) printf("%d",(t-sum)/5);
    else printf("-1");

}


#include<stdio.h>
int main()
{
    long long int a,n,m,i,j;
    scanf("%lld%lld%lld",&n,&m,&a);
    if(n>=1&&a<=1e9&&a!=0)
    {
        if(n%a==0)
            i=n/a;
        else{
            i=n/a;
            i=i+1;
        }
        if(m%a==0)
            j=m/a;
        else{
            j=m/a;
            j=j+1;
        }
        i=i*j;
        printf("%lld",i);
    }
    return 0;
}


#include<stdio.h>
int main()
{
	int a,b,c,i;
	scanf("%d%d%d",&a,&b,&c);
	for(i=a;i>=0;i--)
	{
		if(2*i<=b && 4*i<=c)
			break;
	}
	printf("%d\n",7*i);
	return 0;
}


#include<stdio.h>

int main()
{
	int n,p,k,s;
	scanf("%d %d %d",&n,&p,&k);
	if ((p-k)<=1)
	printf("");
	else
	printf("<<");
	////////
	for (int i=0;i<=k;i++)
	{
	if (i!=k)
	{
	if (p-k+i>0)
	printf(" %d",p-k+i);
	else
	printf("");
	}
	else
	printf(" (%d)",p);
	}
	////////////
	for (int i=0;i<=k;i++)
	{
	s=p+1+i;
	if (s<=n)
	{
	if (i!=k)
	printf(" %d",s);
	}
	else
	printf("");
	}
	if (s<=n)
	printf(" >>");
	else
	printf("");
	return 0;
}


#include<stdio.h>
int main(){
    int n=1,k,c=0;
    scanf("%d",&k);
    while(n<=1000000000){
        int s=0;
        int num=n;
        while(num!=0){
        int  r = num % 10;
        s= s+r;
        num = num/10;
        }
        n++;
        if(s==10)
        {
            c++;
        }
        if(c==k){
            printf("%d",n-1);
            break;
        }
    }

}


#include <stdio.h>
#include <stdint.h>

#define mod 998244353LL

typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;

u_int64_t dp[2005][2005];

void read_u_int32_t(FILE *__restrict stream, u_int32_t *__restrict nr) {
    uint8_t ch;
    *nr = 0;
    while ((ch = fgetc(stream)) && ('0' <= ch && ch <= '9')) {
        *nr *= 10;
        *nr += ch - '0';
    }
}

int main() {
    u_int32_t n, m, k;
    {
        read_u_int32_t(stdin, &n);
        read_u_int32_t(stdin, &m);
        read_u_int32_t(stdin, &k);
    }
    dp[1][0] = m;
    {
        int32_t i, j;
        for (i = 1; i <= n; ++i) {
            for (j = 0; j <= k; ++j) {
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= mod;
                dp[i + 1][j + 1] += dp[i][j] * (m - 1);
                dp[i + 1][j + 1] %= mod;
            }
        }
    }
    {
        fprintf(stdout, "%lu", dp[n][k]);
    }

    return 0;
}


#include"stdio.h"
int p(int n){
  if(n==0)
    return 5;
  else
    return 2*p(n-1); }
int s(int n){
    if(n==0)
      return 5;
    else
      return p(n)+s(n-1); }
int rest(int N){
    int i=0;
    while(i<30){
      if((N-s(i))<p(i+1) && (N-s(i))>=0)
	return N-s(i);
      else if(N<5)
	return N;
    i++; }}
int expo(int N){
  int i=0;
  while(i<30){
    if((N-s(i))<p(i+1) && (N-s(i))>=0)
      return i;
    else if(N<5)
      return 0;
  i++; }}
int main(){
  int M;
  scanf("%d",&M);
if(M>4){
  double s=5*rest(M);
  double q=p(expo(M)+1);
  double r=s/q;

   if(0<r&&r<=1)
   	 printf("Sheldon\n");
   else if(1<r&&r<=2)
     printf("Leonard\n");
   else if(2<r&&r<=3)
     printf("Penny\n");
   else if(3<r&&r<=4)
     printf("Rajesh\n");
   else if(4<r&&r<=5)
     printf("Howard\n");
   else
	 printf("Howard\n"); }
else
	if(M==1)
	printf("Sheldon\n");
	if(M==2)
	printf("Leonard\n");
	if(M==3)
	printf("Penny\n");
	if(M==4)
	printf("Rajesh\n");

return 0; }


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

int main()
{
    char table[3], hands[3];
    int s = 0;
    scanf("%s", table);

        for(int i = 0; i < 5; i++)
        {
           s = 0;
           scanf("%s", hands);
           if(hands[s] == table[s] || hands[s+1] == table[s+1]) {printf("YES"); return 0;}
           else continue;
        }
    printf("NO ");
    return 0;
}


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


#include<stdio.h>
int main()
{  long long int m,n,i,k,c;
scanf("%lld %lld",&m,&n);
if(m==n)
    {printf("YES\n");
     printf("0");
     }
else
 {
     i=m; c=0;
     while(1)
     {
         i=i*m;
         c++;
         if(i>=n)
         break;
     }
     if(i==n){
     k=c;
     printf("YES\n");
     printf("%lld\n",k);}
     else
     {
         printf("NO");
     }
 }

     return 0;

 }


#include <stdio.h>

int main(int argc, char ** argv){
	int t,s,x;
	scanf("%d %d %d",&t,&s,&x);
	int start=t;
	if(start==x){
		printf("%s", "YES");
		return 0;
	}
	while(start<x){
		start+=s;
		if(start==x || (start+1)==x){
			printf("%s", "YES");
			break;
		}

	}
	if(start>x){
		printf("%s","NO");
	}

	return 0;
}


#include <stdio.h>

int main(int argc, char* argv[])
{
	int numberOfDancers, whiteSuitCost, blackSuitCost;
	scanf("%d %d %d", &numberOfDancers, &whiteSuitCost, &blackSuitCost);

	//Getting the cheapest suit.
	int cheapSuitCost, cheapSuitFlag;
	if(whiteSuitCost < blackSuitCost)
		cheapSuitCost = whiteSuitCost;
	else
		cheapSuitCost = blackSuitCost;

	int dancers[numberOfDancers];

	//Getting dancers arrangment.
	int i;
	for(i = 0;i < numberOfDancers;i++)
		scanf("%d", &dancers[i]);

	//Buy the cheapest suit for the center dancer.
	int cost = 0;
	if(numberOfDancers % 2 != 0)
	{
		if(dancers[numberOfDancers/2] == 2)
			cost += cheapSuitCost;
	}

	int j;
	if(numberOfDancers % 2 == 0)
		j = numberOfDancers / 2;
	else
		j = (numberOfDancers/2) + 1;

	for(i = (numberOfDancers/2) - 1;i >= 0;i--)
	{

		if(dancers[i] + dancers[j] == 1)
		{
			printf("-1");
			return 0;
		}
		else if(dancers[i] == 2 && dancers[j] == 2)
			cost += (cheapSuitCost * 2);
		else if(dancers[i] == 1 && dancers[j] == 2)
			cost += blackSuitCost;
		else if	(dancers[i] == 2 && dancers[j] == 1)
			cost += blackSuitCost;
		else if(dancers[i] == 0 && dancers[j] == 2)
			cost += whiteSuitCost;
		else if(dancers[i] == 2 && dancers[j] == 0)
			cost += whiteSuitCost;

		j++;
	}

	printf("%d", cost);

	return 0;
}


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


#include<stdio.h>

typedef unsigned int u_int;

int main(void){
  u_int a,b;
  u_int i,j;
  u_int an;
  unsigned long long int counta=0,countb=0;
  scanf("%u %u",&a,&b);
  if(a>b){
    an=a%b;
    while(an!=0){
      counta+=an;
      countb+=a-an;
      an=(an+a)%b;
    }
    counta+=b;
    countb+=a-b;
    if(counta>countb) puts("Dasha");
    else if(counta==countb) puts("Equal");
    else puts("Masha");
  }else{
    b+=a;
    a=b-a;
    b-=a;
   an=a%b;
   while(an!=0){
      counta+=an;
      countb+=a-an;
      an=(an+a)%b;
    }
    counta+=b;
    countb+=a-b;
    if(counta>countb) puts("Masha");
    else if(counta==countb) puts("Equal");
    else puts("Dasha");
  }
  return 0;

}


#include <stdio.h>
# include <string.h>
int main()
{
    char ch[100];
    scanf("%s",&ch);
    int i,c1=0,c2=0;
     for(i=0;i<strlen(ch);i++)
      {
         if(ch[i]==4+48)
             c1++;
         else if(ch[i]==7+48)
              c2++;
     }
     if(c1==0 && c2==0)
         printf("-1\n");
       else if(c1>=c2)
           printf("4\n");
          else
          printf("7\n");
         return 0;
        }


#include<stdio.h>
main()
{
    int s,v1,v2,t1,t2;
    scanf("%d",&s);
    scanf("%d %d %d %d",&v1,&v2,&t1,&t2);

    int ans1=v1*s+2*t1;
    int ans2=v2*s+2*t2;

    if(ans1<ans2) printf("First\n");
    else if(ans1>ans2) printf("Second\n");
    else printf("Friendship\n");

    return 0;
}


/*
 * mike.c
 *
 * Copyright 2019  <examuser@11cpu0244L>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 *
 *
 */

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

int main(int argc, char **argv)
{
	char s[15];int a=0;
	scanf("%s",s);
	int k=strlen(s);
	for(int i=0;i<k/2;i++)
	{
		if(s[i]!=s[k-i-1])
		a=a+1;
	}
	if(k%2!=0){
		if(a<=1)
		printf("YES\n");
	else
		printf("NO\n");
	}
	else{
	if(a==1)
			printf("YES\n");
	else
		printf("NO\n");
	}
	return 0;
}


#include <stdio.h>

int min (int a, int b)
{
	if (a<b)
		return a;
	else
		return b;
}

int main (void)
{
	int n, a, b, max=0;
	scanf ("%d %d %d", &n, &a, &b);

	int i;
	for (i=1 ; i<n ; i++)
	{
		if (max < min((a/i), (b/(n-i))))
			max=min((a/i), (b/(n-i)));
	}

	printf("%d", max);

	return 0;
}


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


#include <stdio.h>

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

int main()
{
    int n, m;
    long long x;

    scanf("%d %d", &n, &m);

    x = f(3, n, m);

    printf("%d\n", (int)((x - 1 + m) % m));

    return 0;
}


//Bismillahirrahmanirrahim//
#include <stdio.h>
long long n,i;
int main()
{
scanf("%lld",&n);
for( i=1000000;i>1;i--)
{
	while(n%(i*i)==0)
	{
	n=n/i;
	}
}
	printf("%lld",n);
return 0;
}


#include<stdio.h>
#include<math.h>
long long int gcd(long long int x,long long int y)
{
	if(x==0)
	{
		return y;
	}
	while(y!=0)
	{
		if(x>y)
		{
			x=x-y;
		}
		else
		{
			y=y-x;
		}
	}
	return x;
}
int main( )
{
	long long int x,y,a,b,c=0,l=0,z,i=0,k;
	scanf("%lld %lld %lld %lld",&x,&y,&a,&b);
	z=gcd(x,y);
	l=(x*y)/z;
	c=(b/l)-((a-1)/l);
	printf("%lld\n",c);
	return 0;
}


#include <stdio.h>

#define true 1
#define false 0

short is_prime(unsigned long);
short find_minimum_tax(unsigned long);

int main()
{
    short minimum_taxes;
    unsigned long total_taxes;
    scanf("%lu",&total_taxes);
    minimum_taxes = find_minimum_tax(total_taxes);
    printf("%hu\n",minimum_taxes);
    return 0;
}

//Happens in O(root(n)) time
short is_prime(unsigned long n)
{
    short prime = true;
    unsigned long i;

    for(i = 2; i*i <= n; i++)
    {
        if(n%i == 0)
        {
            prime = false;
            break;
        }
    }
    return prime;
}

/*If the number is prime, then only 1 has to be paid. That is the minimum possible.
The next minimum is 2.
Since the Goldbach conjecture has been verified upto the limit, we can use it. Any even number is the sum of two primes.
We don't need to actually find the pair of primes, we just know it exists.
If a number is odd and composite , n = (n-2) + 2, is the only way it can be written as the sum of two primes. 2 is the only even prime number.
The sum of two odd numbers is another odd number. So, an even number has to be involved. If (n-2) is prime, then the minimum tax = 1+1 = 2

n = n-3 + 3, and then n-3 is an even number and has minimum return 2. 3 is prime. 2+1 = 3. This is the maximum possible tax that will ever be given
following the scheme.

Note - Although logically the first thing to do is check if a number is prime and return 1 if it is and then go for the other test,
I have included it second because checking parity of number is a very quick and easy process Even numbers don't need to be subjected to primality tests.*/
short find_minimum_tax(unsigned long tax)
{
    //According to Goldbach conjecture, every even number can be written as the sum of two odd primes, It has been numerically verified upto the limit given
    if( (tax%2 == 0) && (tax != 2) )
    {
        return 2;
    }
    else if(is_prime(tax))
    {
        return 1;
    }
    else
    {
        //If n-2 is prime, then n = (n - 2) + 2 is the sum of two primes. This is the only way since one summand has to be even to get an odd number
        if(is_prime(tax - 2))
        {
            return 2;
        }
        else //Then, n = (n-3) + 3. n-3 is an even number and can be written as the sum of two odd primes
        {
            return 3;
        }
    }
}


#include<stdio.h>
int main()
{
    int n,m,sum,d;
    scanf("%d %d",&n,&m);
    sum=n;
    rich:
    d=n/m;
    if(d>0)
    {
    sum=sum+d;
    if(((n%m)+d)>=m)
    {
    n=(n%m)+d;
    goto rich;
    }
    }
    printf("%d",sum);
    return 0;
}


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

 for(i=0;i<n;i++)
 { freq[a[i]]++;
 }
 for(i=1;i<601;i++)
 { if(freq[i]>0) count++;
 }
 printf("%d",count);
 return 0;
 }


#include <stdio.h>
#include <math.h>
int min(int a, int b)
{
    return a<b ? a : b;
}
int main()
{
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    if(x1==x2 && y1==y2)
    {
        printf("0 0 0\n");
        return 0;
    }
    //rook
    if(x2 == x1 || y2 == y1)
        printf("1 ");
    else
        printf("2 ");
    //bishop
    if(((x1+y1) & 1) != ((x2+y2) & 1))
        printf("0 ");
    else if((int)fabs(x2-x1) == (int)fabs(y2-y1))
        printf("1 ");
    else
        printf("2 ");
    //king
    if((int)fabs(x2-x1) == min(fabs(x1-x2), fabs(y1-y2)))
        printf("%d\n", (int)fabs(y2-y1));
    else
        printf("%d\n", (int)fabs(x2-x1));
    return 0;
}


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


#include<stdio.h>
#include<string.h>
int main()
{
    int n,k,b[105],flag=0;
    char s[105];
    memset(b,0,sizeof(b));
    scanf("%d%d%s",&n,&k,s);
    for(int i=0;i<n;i++)
    {
        b[s[i]-'0']++;
    }
        for(int i=40;i<=100;i++)
            if(b[i]>k)
                flag=1;
        if(flag==1) printf("NO\n");
        else printf("YES\n");

    return 0;
}


#include <stdio.h>
int findMax(int n)
{
	if(n==1)
		return 0;
	int i;
	for(i=2; i<=n; i++)
		if(n%i==0)
			return n/i+findMax(n/i);

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

	int sum=n;
	sum=sum+findMax(n);

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

	return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main()
{
   long long N,x=0;
   scanf("%lld",&N);
   while(x*(x+1)/2<N)
    x++;
   printf("%lld\n",N-x*(x-1)/2);
    return 0;
}


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

const int MOD = 1000000007;

int main(void) {
   int n, k, d, ans, i, j;
   scanf("%d%d%d", &n, &k, &d);
   int memW[n + 1];
   int memWO[n + 1];
   for (i = 0; i <= n; i++)
      memW[i] = (memWO[i] = 0);
   memW[0] = (memWO[0] = 1);
   for (i = 0; i < n; i++)
      for (j = 1; j + i <= n && j <= k; j++){
         memW[j + i] += memW[i];
         if (memW[i + j] >= MOD)
            memW[i + j] -= MOD;
         if (j < d){
            memWO[j + i] += memWO[i];
            if (memWO[i + j] >= MOD)
               memWO[i + j] -= MOD;
         }
      }
   ans = memW[n] - memWO[n];
   if (ans < 0)
      ans += MOD;
   printf("%d\n", ans);
   return 0;
}


#include <stdio.h>
int main()
  {
	long int n;
	int i,k,sum=0,dig,cnt=0;
	scanf ("%ld",&n);
	for(i=n+1;;i++)
	{
		sum++; k=i;
		while(k)
		{
         if(abs(k%10)==8)
         { cnt=1; break;}
         k/=10;
	    }
	    if (cnt==1)
	    break;
	}
	printf("%d",sum);
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	char str1[500000],str2[500000];
	int m, n;
	scanf("%d %d", &n, &m);
	int i, j, k;
	int countRed=n, countBlue=m;
	str1[0]='r';
	for(i=1;i<=m+n;i++)
	{
		if(i%2==1)
		{
			if(str1[i-1]=='r')
			{
				if(countRed>0)
				{
					str1[i]='r';
					countRed--;
				}
				else
				{
					str1[i]='b';
					countBlue--;
				}
			}
			else if(str1[i-1]=='b')
			{
				if(countBlue>0)
				{
					str1[i]='b';
					countBlue--;
				}
				else
				{
					str1[i]='r';
					countRed--;
				}
			}
		}
		else
		{
			if(str1[i-1]=='r')
			{
				if(countBlue>0)
				{
					str1[i]='b';
					countBlue--;
				}
				else
				{
					str1[i]='r';
					countRed--;
				}
			}
			else if(str1[i-1]=='b')
			{
				if(countRed>0)
				{
					str1[i]='r';
					countRed--;
				}
				else
				{
					str1[i]='b';
					countBlue--;
				}
			}
		}
	}
	str2[0]='b';
	countBlue=m;countRed=n;
	for(i=1;i<=m+n;i++)
	{
		if(i%2==1)
		{
			if(str2[i-1]=='b')
			{
				if(countBlue>0)
				{
					str2[i]='b';
					countBlue--;
				}
				else
				{
					str2[i]='r';
					countRed--;
				}
			}
			else if(str2[i-1]=='r')
			{
				if(countRed>0)
				{
					str2[i]='r';
					countRed--;
				}
				else
				{
					str2[i]='b';
					countBlue--;
				}
			}
		}
		else
		{
			if(str2[i-1]=='b')
			{
				if(countRed>0)
				{
					str2[i]='r';
					countRed--;
				}
				else
				{	str2[i]='b';
					countBlue--;
				}
			}
			else if(str2[i-1]=='r')
			{
				if(countBlue>0)
				{
					str2[i]='b';
					countBlue--;
				}
				else
				{	str2[i]='r';
					countRed--;
				}
			}
		}
	}
	int count1=0, count2=0,count3=0, count4=0;
	//printf("%s %s",str1, str2);
	for(i=1;i<strlen(str1)-1;i++)
	{
		if(str1[i]==str1[i+1])
		 count1++;
		else
			count3++;
		if(str2[i]==str2[i+1])
			count2++;
		else
			count4++;
	}
	if(count1>count2)
		printf("%d %d\n",count1, count3);
	else
		printf("%d %d\n",count2, count4);
	return 0;
}


#include <stdio.h>

int main(void)
{
    int i, nz, no, n, x;
    scanf("%d\n", &n);

    nz = no = 0;

    for (i = 0; i < n; i++) {
        x = getchar();
        if (x == '1') {
            no++;
        } else if (x == '0') {
            nz++;
        }
    }

    if (no >= 1) {
        printf("1");

        for (i = 0; i < nz; i++) {
            printf("0");
        }
    } else {
        printf("0");
    }

    return 0;
}


 #include<stdio.h>
#include<string.h>
int check(char[],char[]);
int main(){
char s[100];
 char name[10][10]={"Danil", "Olya", "Slava", "Ann", "Nikita"};
 int i,j,k,l1,l2,c=0;
 scanf("%s",&s);
l1=strlen(s);
 for(i=0;i<5;i++)
   {
   	l2=strlen(name[i]);
   	for(j=0;j<l1-l2+1;j++)
   	{
   		int f=1;
   		for(k=0;k<l2;k++)
   		if(s[j+k] != name[i][k])
   		 f=0;

   		if(f)
   		 c++;
	   }
   }

if(c==1) printf("YES");
else printf("NO");

}


#include<stdio.h>
int main()
{
    int c, a, b, i;

    scanf("%d %d", &a, &b);
    for(i=1;;i++) {
        a = a * 3;
        b = b * 2;
        if(a > b) {
            c = i;
            break;
        }
    }
    printf("%d", c);
}


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


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

int main()
{
    int n,t,k,d;
    scanf("%d%d%d%d",&n,&t,&k,&d);
    int ans=((d/t)+1)*k;
        if(ans<n)
            printf("YES");
        else
            printf("NO");

    return 0;
}


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

int main()
{
    long int a,b,c;
    while(~scanf("%ld",&a))
    {
        if(a>=5)
        {
            b=a/5;
            c=a%5;
            if(c!=0)
            {
                b++;
                printf("%ld\n",b);
            }
            else
                printf("%ld\n",b);
        }
        if(a<5)
        printf("1\n");
    }
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
     int n,a,b,c,x,y,sum,temp;
     scanf("%d%d%d%d", &n,&a,&b,&c);
     if(n==1)
     {
         printf("0\n");
     }

      else
      {
         if(n==2)
         {
             if(a>b)
             {
                   printf("%d\n", b);
             }
             else
             {
                 printf("%d\n", a);
             }

         }
         else
         {
              if(a<=b&&a<=c)
              {
                  sum=(n-1)*a;
              }
               else if(b<=a&&b<=c)
               {
                   sum=(n-1)*b;
               }
               else
               {
                   if(a<b)
                   {
                       sum=a+(n-2)*c;
                   }
                   else
                   {
                       sum=b+(n-2)*c;
                   }
               }
                printf("%d\n", sum);
         }
      }

     return 0;
}


#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    char ch[n+1];
    scanf("%s",ch);
    int cnt=0,nct=0,minus=0,sum=0;
    for(int i=0;ch[i]!='\0';i++){
        if(ch[i]=='+'){
            sum++;
        }
        else if(ch[i]=='-'){
            sum--;
        }
        if(sum<0){
            sum=0;
        }
    }
    printf("%d\n",sum);
    return 0;
}


//————————三角形问题————————
#include <stdio.h>

int main()
{
    char san(int x,int y,int z);
    void maxtomin(int a[]);

    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    int s[4]={a,b,c,d};
    maxtomin(s);
    a=s[0];b=s[1];c=s[2];d=s[3];
    if(san(a,b,c)=='y'||san(b,c,d)=='y') printf("TRIANGLE");
    else if(san(a,b,c)=='d'||san(b,c,d)=='d') printf("SEGMENT");
    else if(san(a,b,c)=='n'&&san(b,c,d)=='n') printf("IMPOSSIBLE");

    return 0;
}

void maxtomin(int a[])
{
    int i,j,t;
    for(i=0; i<4; i++)
    {
        for(j=i+1; j<4; j++)
        {
            if(a[i]<a[j])
            {
                t = a[i];
                a[i] = a[j];
                a[j] = t;
            }
            else continue;
        }
    }
}

char san(int x,int y,int z)
{
    char r;
    if(x+y>z&&x+z>y&&z+y>x) r='y';
    else if(x+y==z||x+z==y||y+z==x) r='d';
    else r='n';

    return r;
}


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

int main()
{
    int n, m, ans, ans2, max, dima, total;
    ans2 = 0;
    ans = 0;
    scanf("%d", &n);
    total = n+1;
    while(n--){
        scanf("%d", &m);
        ans = ans+m;
    }
    max = ans + 5;
    dima = total + 1;
    while(1){
        if(dima>ans && dima<=max){
            ans2++;
        }
        dima +=total;
        if(dima>max) break;
    }
    ans2 = 5 - ans2;
    printf("%d\n", ans2);
    return 0;
}


#include<stdio.h>
//#include<conio.h>
int main()
{
long long int n;
scanf("%ld",&n);
printf("%ld",6*n*(n-1)+1);
//getch();
return(0);
}


#include <stdio.h>

int main () {
  int n;
  scanf("%d", &n);
  printf("%d\n", 2*(n/3) + (n%3 != 0));
  return 0;
}


#include <stdio.h>

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

  int lim = (1 << nor) ;
  // printf("%d", lim) ;
  for(int k = 0; k < lim ; k++) {
    // printf("%d",i) ;
    int i = k ;
    int sum = 0 ;
    for(int j = 0 ; j < nor ; j++) {
      // printf("%d", i % 2) ;
      if(i % 2) {
        sum += rots[j] ;
      } else {
        sum -= rots[j] ;
      }
      i = i >> 1 ;
    }
    if(sum % 360 == 0) {
      printf("YES") ;
      return 0 ;
    }
  }

  printf("NO") ;
  return 0 ;
}


#include<stdio.h>
#include<string.h>
int main(){
    char ch[100];
    int c=0,t=0;
    scanf("%s",ch);
    int l=strlen(ch);
    for(int i=0;i<l-1;i++)
    {

        if(ch[i]==ch[i+1])
            c++;
        else
            c=0;
        if(c>=6)
    {printf("YES");
    return 0;
        //break;
    }

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


#include <stdio.h>

int main()
{
char e, str[101], *keyboard="qwertyuiopasdfghjkl;zxcvbnm,./";
int key, i, j;
scanf(" %c %s", &e, str);
if(e=='R')key=-1;
else key=1;
	for(i=0; str[i]!='\0'; i++)
		for(j=0; keyboard[j]!='\0'; j++)
			if(str[i]==keyboard[j])
			{
				str[i]=keyboard[j+key];
				break;
			}
printf("%s", str);
return 0;
}


#include<stdio.h>
int main()
{
    int n,m,max,min, var,i,flag=0;
    scanf("%d %d %d %d",&n,&m,&min,&max);
    var= n-m;
    int temp[m];
    //printf("%d\n",var);
    for(i=0;i<m;i++)
    {
       scanf("%d",&temp[i]);
    }
     for(i=0;i<m;i++)
     {
         if(temp[i] <min || temp[i] >max)
              {
                    flag = 1;
                    break;
               } //incorrect
     }
     if(flag!=1)
     {
     if(var<2 && var >0)
     {
              for(i=0;i<m;i++)
              {
                 if(temp[i] == max || temp[i] == min)
                  {
                            flag = -1;
                            break;
                  }
                  flag = 1;
              }

     }
     }
     if(flag==1)
       printf("Incorrect\n");
     else if(flag == -1)
       printf("Correct\n");
     else if(flag == 0)
       printf("Correct\n");

    //getch();
    return 0;
}


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

char board[8][9] = {0};

int checkBoard() {
  int i;
  for(i = 0; i < 8; i++) {
    if(strcmp(board[i], "BWBWBWBW") != 0 && strcmp(board[i], "WBWBWBWB") != 0)
      return 0;
  }
  return 1;
}

int main() {
  int i, j;
  char row[20];
  for(i = 0; i < 8; i++) {
    scanf("%s\n", row);
    for(j = 0; j < 8; j++)
      board[i][j] = row[j];
  }

  if(checkBoard())
    printf("YES");
  else
    printf("NO");

  return 0;
}


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


/* practice with Dukkha */
#include <stdio.h>

#define N	30

long long ch[N + 1][N + 1];

void init() {
	int i, j;

	ch[0][0] = 1;
	for (i = 1; i <= N; i++) {
		ch[i][0] = 1;
		for (j = 1; j <= i; j++)
			ch[i][j] = ch[i - 1][j] + ch[i - 1][j - 1];
	}
}

int main() {
	int n, m, t, b, g;
	long long ans;

	init();
	scanf("%d%d%d", &n, &m, &t);
	ans = 0;
	for (b = 4; b <= n && b < t; b++) {
		g = t - b;
		if (g <= m)
			ans += ch[n][b] * ch[m][g];
	}
	printf("%lld\n", ans);
	return 0;
}


#include<stdio.h>
#include<string.h>
main()
{
        char str1[101], str2[101];
        int min=0, zero=0;
        scanf("%s", str1);
        scanf("%s", str2);
        int i, l = strlen(str1);
        for(i = 0; i < l; i++)
        {
                if(str1[i] >= 'A' && str1[i] <= 'Z')
                {
                        str1[i] = str1[i] - 'A' + 'a';
                }
                if (str2[i] >= 'A' && str2[i] <= 'Z')
                         str2[i] = str2[i] - 'A' + 'a';
        }
        /*for(i = 0; i < l; i++)
        {
                sum1 = sum1 + str1[i];
                sum2 = sum2 + str2[i];
        }*/
        for(i = 0; i < l; i++)
        {
                if(str1[i] == str2[i])
                        zero++;
                else if(str1[i] < str2[i])
                        {
                                printf("-1");
                                min++;
                                break;
                        }
                else if(str1[i] > str2[i])
                        {       printf("1");
                                min++;
                                break;
                        }
        }
        if(zero >0&&min==0)
                printf("0");
}


#include<stdio.h>
int main()
{
    char a,s[3],t[3];
    scanf("%c",&a);
    scanf("%s %s",&s,&t);
    if(s[1]==t[1]){
            if(s[0]<60&&t[0]>60)printf("NO");
            else if(s[0]>60&&t[0]<60)printf("YES");
            else if(s[0]<60&&s[0]>t[0])printf("YES");
            else if(s[0]<60&&s[0]<t[0]) printf("NO");
            else{
                if(s[0]==74){if(t[0]==84)printf("YES");
                          else printf("NO");}
                else if(t[0]==74){if(s[0]==84)printf("NO");
                          else printf("YES");}
                else if(s[0]>t[0])printf("NO");
                else printf("YES");
            }
    }
    else{
        if(s[1]==a)printf("YES");
        else printf("NO");
    }
    return 0;
}


#include <stdio.h>

int main(void)
{
    int r, g, bb;
    long long int a, b, c;

    for (;;) {
        if (scanf(" %d %d %d", &r, &g, &bb) != 3)
            return 0;
        if (r >= g && r >= bb) {
            a = r;
            if (g >= bb) {
                b = g;
                c = bb;
            } else {
                b = bb;
                c = g;
            }
        } else if (g >= bb) {
            a = g;
            if (r >= bb) {
                b = r;
                c = bb;
            } else {
                b = bb;
                c = r;
            }
        } else {
            a = bb;
            if (r >= g) {
                b = r;
                c = g;
            } else {
                b = g;
                c = r;
            }
        }
        if (a >= ((b + c) * 2)) {
            printf("%ld\n", (long int)(b+c));
        } else {
            printf("%ld\n", (long int)( c + ((a - c) + (b - c)) / 3) );
        }
    }

    return 0;

}


#include <stdio.h>

int main()
{
    int r,c,i,j,count=0,maxr=0,maxc=0;
    scanf("%d%d",&r,&c);
    char a[r][c];
    for(i=0;i<r;i++)
        scanf("%s",a[i]);
    for(i=0;i<r;i++)
    {
        for(j=0;j<c;j++)
        {
            if(a[i][j]=='S')
                break;
            else
                count++;
        }
        if(count==c)
            maxr++;
        count=0;
    }
     for(i=0;i<c;i++)
    {
        for(j=0;j<r;j++)
        {
            if(a[j][i]=='S')
                break;
            else
                count++;
        }
        if(count==r)
            maxc++;
        count=0;
    }
    int p=maxr*c+maxc*r-(maxr*maxc);
    printf("%d",p);

}


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

int sec(int *mass, int n, int a) {
    if (n == a) {
        a = 1;
        return a;
    }

    int box = 1;
    for (int i = 0; i < n; i++) {
        if (!(i % 2)) {
            mass[i] = box;
            box++;
        }
    }

    box--;

    for (int i = 0; i < n; i++) {
        if (i % 2) {
            mass[i] = box;
            box--;
        }
    }

    a--;

    return mass[a];
}

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

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

    int *mass = (int*) malloc(n * sizeof (int));

    sec(mass, n, a);

    printf("%d", sec(mass, n, a));

    return 0;
}


#include<stdio.h>

int main(){
	int gleft,gright,bleft,bright;
	int flag=0;
	scanf("%d %d",&gleft,&gright);
	scanf("%d %d",&bleft,&bright);

	if(bleft==1 && gright==1)flag=1;
	else if(gleft==1 && bright==1)flag=1;
	else if(gleft*2+3>bright && gleft <=bright+1)flag=1;
	else if(gright*2+3>bleft && gright <=bleft+1)flag=1;

	if(flag==1)printf("YES\n");
	else printf("NO\n");
	return 0;
	}


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

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

int a[100], count;

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

    int i, j, temp;

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

    ///printf("count : %d\n", count);

    temp = a[0];

    if (n>1)
    {
        for (i=0; i<n; i++)
        {
            temp = max(temp, a[i]);
        }
    }

    ///printf("temp : %d\n", temp);

    int k;

    int ans;

    for (i=0; ; i++)
    {
        k = temp+i;
        if (((n*k)-count)>count)
        {
            ans = k;
            break;
        }
    }

    printf("%d", ans);

    return 0;
}


/*!
 * @file    a.c
 * @version 1.0
 * @date    17/04/2014
 * @author  Anton Leontiev <bunder@t-25.ru>
 *
 * @copyright
 *
 * Copyright (c) 2014, Anton Leontiev
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted
 * provided that the following conditions are met:
 *
 *  1. Redistributions of source code must retain the above copyright notice, this list of
 *     conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright notice, this list of
 *     conditions and the following disclaimer in the documentation and/or other materials
 *     provided with the distribution.
 *  3. Neither the name of Anton Leontiev nor the names of its contributors may be used
 *     to endorse or promote products derived from this software without specific prior written
 *     permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */

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

int main(int argc, char *argv[]) {
	int a, b, c, d, n, k, m, min = INT_MAX;
	scanf("%u %u %u %u %u", &c, &d, &n, &m, &k);
	for (a = 0; a <= m; a++) {
		b = n * (m - a) - k;
		b = b > 0 ? b : 0;
		if (min > a * c + b * d) min = a * c + b * d;
	}
	printf("%u\n", min);
	return EXIT_SUCCESS;
}


#include <stdio.h>
#include <math.h>
int main(){
		int i;
		scanf("%d",&i);
		printf("25");
		return 0;
}


#include<stdio.h>
int main()
{
    int n,k,l,c,d,p,nl,np,u,v,x,m,o;
    scanf("%d %d %d %d %d %d %d %d",&n,&k,&l,&c,&d,&p,&nl,&np);
    u=(k*l)/nl;//need per ml of drink
    v=(c*d);//lime
    o=p/np;
    if(u<=v&&u<=o)
        x=u;
    else if(v<=u&&v<=o)
        x=v;
    else
        x=o;
    m=x/n;
    printf("%d",m);
    return 0;
}


#include <stdio.h>

int main(){
    int n, k;
    scanf("%d %d", &n, &k);
    int a[n];
    for (int i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    int hour = k;
    for (int i = 0; i  < n; i++){
        if (k % a[i] == 0 && hour > (k / a[i])){
            hour = k / a[i];
        }
    }
    printf("%d",hour);
    return 0;
}


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

int main()
{
    long long k,b,t,x=1;
    int l=0,n;
    scanf("%lld %lld %d %lld",&k,&b,&n,&t);
    while(x<t&&l<n)
    {
        x=k*x+b;
        l++;
    }
    if(x>t)
    {
        l--;
    }
    printf("%d",n-l);
    return 0;
}


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

    int n,i;
    scanf("%d",&n);
    if(n == 0)
    {
        printf("1");
    }
    else
    {
        i = n%4;
        switch(i)
        {
        case 1 :
            printf("8");
            break;
        case 2 :
            printf("4");
            break;
        case 3 :
            printf("2");
            break;
        case 0 :
            printf("6");
            break;
        }
    }
    return 0;
}


#include <stdio.h>

/*
 * http://codeforces.com/problemset/problem/652/A
 */
int main()
{
    int hc = 0, ha = 0;
    scanf("%d %d", &hc, &ha);

    int a = 0, b = 0, d = 0;
    scanf("%d %d", &a, &b);

    hc += 8 * a;

    if (hc < ha && a <= b) {
        printf("-1\n");

        return 0;
    }

    while (hc < ha) {
        hc += a * 12 - b * 12;
        d += 1;
    }

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

    return 0;
}


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

char arr[4][4];

int boardval(char * loc)
{
		if (*loc == '#')
				return 1;
		else return -1;
}

int main(void)
{
		for (int i = 0; i < 4; i++)
				for (int j = 0; j < 4; j++)
						scanf("%c ", &arr[i][j]);

		int sum;
		for (int i = 0; i < 3; i++)
				for (int j = 0; j < 3; j++){
						sum = 0;
						sum += (boardval(&arr[i][j]) + boardval(&arr[i+1][j]) + boardval(&arr[i][j+1]) + boardval(&arr[i+1][j+1]));
						if (abs(sum) >= 2){
								printf("YES\n");
								return 0;
						}
		}

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


#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
int main()
{
    int i,j;
    char s[600];
    scanf("%s", s);
    int l=strlen(s);
    int a[26]={0};
    for(i=0;i<l;i++)
    {
        for(j=0;j<((int)s[i]-97); j++)
        {
            if(a[j]==0)
            {

                printf("NO");
                return 0;
            }
        }
        a[(int)s[i]-97]=1;
    }
    printf("YES");
    return 0;
}


#include <stdio.h>

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

int lcd(int a, int b) {
	return a*b/gcd(a, b);
}

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

	if (a*d > b*c) {
		int g = gcd(a*d - b*c, a*d);
		printf("%d/%d\n", (a*d - b*c)/g, a*d/g);
	} else {
		int g = gcd(b*c - a*d, b*c);
		printf("%d/%d\n", (b*c - a*d)/g, b*c/g);
	}

	return 0;
}


#include<stdio.h>

int power(int a,int b)
{
    int i,sum=1;

    for(i=0;i<b;i++)
    {
        sum=sum*a;
    }

    return sum;
}

int main()
{
    int i,k,r,m=0,l=0,n,j;

    scanf("%d %d",&k,&r);

    if(k%5==0)
    {
        if(r==5 || k%10==0)
        {
            printf("1");

            return 0;
        }
        else
        {
            printf("2");

            return 0;
        }
    }
    else
    {
        for(i=1;;i++)
        {
            m=k*i;

            if(m%10==r)
            {
                break;
            }
            else if(m%10==0)
            {
                break;
            }
            else
            {
                m=0;
            }
        }
    }

    printf("%d",i);

    return 0;
}


#include <stdio.h>
#define gc getchar()
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>
#include<stdlib.h>
int main(){
int m,h,a,s,r,x,y;
char c;
scanf("%d  %c  %d",&h,&c,&m);
scanf("%d",&a);
s=a%60;
r=a/60;
h=h+r;
m=m+s;
x=m%60;
h=h+(m/60);
y=h%24;
printf("%02d:%02d",y,x);
return 0;
}


#include <stdio.h>
int main()
{
    int n, x, x2;
    x2 = 0;
    scanf("%d", &n);
    getchar();
    char tree[102];
    gets(tree);
    char plant[3];
    for (int i = 0; i < n; i++) {
        x = 0;
        for (int j = 0; j < n; j++) {
            if (tree[j] == tree[i] && tree[j+1] == tree[i+1]) {
                x++;
            }
        }
        if (x > x2) {
            x2 = x;
            plant[0] = tree[i];
            plant[1] = tree[i+1];
        }
    }
    printf("%c%c\n", plant[0], plant[1]);
    return 0;
}


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


#include<stdio.h>
int main()
{
    int a,n,i;
    scanf("%d",&n);

    for (i=0;i<n;i++)
    {
      scanf("%d",&a);
      while(a >= 3 && a % 7 != 0)
        a -= 3;
      if(a == 0 || a % 7 == 0)
         printf("YES\n");
      else
          printf("NO\n");
    }
}


#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d",&a);
    for(b=1;b*10<=a;b=b*10);
    a=a-b*(a/b);
    b=b-a;
    printf("%d",b);
    return 0;
}


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

typedef struct column_
{
	int c[3];
}column_t;

typedef struct matrix_
{
	column_t r[3];
}matrix_t;

typedef struct grid_
{
	matrix_t mx;
}grid_t;

int judge(grid_t *h, int num)
{
	int i = 0;
	for (i = 0; i < 3; ++i)
	{
		if ((num == h->mx.r[i].c[0]) && (num == h->mx.r[i].c[1]) && (num == h->mx.r[i].c[2]))
		{
			return 1;
		}
	}

	for (i = 0; i < 3; ++i)
	{
		if ((num == h->mx.r[0].c[i]) && (num == h->mx.r[1].c[i]) && (num == h->mx.r[2].c[i]))
		{
			return 1;
		}
	}

	if ((num == h->mx.r[0].c[0]) && (num == h->mx.r[1].c[1]) && (num == h->mx.r[2].c[2]))
	{
		return 1;
	}

	if ((num == h->mx.r[0].c[2]) && (num == h->mx.r[1].c[1]) && (num == h->mx.r[2].c[0]))
	{
		return 1;
	}

	return 0;
}

int main()
{
	grid_t t;
	char st[4] = { 0 };
	int tot_1 = 0;
	int tot_2 = 0;
	int win_1 = 0;
	int win_2 = 0;

	int i = 0;
	int j = 0;

	for (i = 0; i < 3; ++i)
	{
		scanf("%s", st);
		for (j = 0; j < 3; ++j)
		{
			switch (st[j])
			{
			case 'X':
				t.mx.r[i].c[j] = 1;
				++tot_1;
				break;
			case '0':
				t.mx.r[i].c[j] = 2;
				++tot_2;
				break;
			case '.':
				t.mx.r[i].c[j] = 0;
				break;
			default:
				break;
			}
		}
	}

	if ((tot_1 - tot_2 < 0) || (tot_1 - tot_2 > 1))
	{
		printf("illegal");
		return 0;
	}

	win_1 = judge(&t, 1);
	win_2 = judge(&t, 2);

	if ((0 == win_1) && (0 == win_2))
	{
		if ((5 == tot_1) && (4 == tot_2))
		{
			printf("draw");
			return 0;
		}

		if (tot_1 > tot_2)
		{
			printf("second");
			return 0;
		}
		printf("first");
		return 0;
	}

	if ((1 == win_1) && (0 == win_2) && (tot_1 > tot_2))
	{
		printf("the first player won");
		return 0;
	}

	if ((0 == win_1) && (1 == win_2) && (tot_1 == tot_2))
	{
		printf("the second player won");
		return 0;
	}

	printf("illegal");
	return 0;
}


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

int chk(long long x)
{
	int ret = 0;
	while(x)
	{
		ret += (x%10);
		x/=10;
	}
	return ret;
}

long long po(long long int a,long long x)
{
	if(x == 0)
		return 1;
	long long temp;
	temp = po(a,x/2);
	temp *= temp;
	if(x%2)
		temp *= a;
	return temp;
}

int main()
{
	long long int a,b,c;
	scanf("%lld %lld %lld",&a,&b,&c);
	long long int i;
	int cnt = 0;
	long long ans[100];
	for(i=1;i<=81;i++)
	{
		long long temp = b*(po(i,a)) + c;
		if(temp <= 1000000000 && temp >=0  && chk(temp) == i)
			ans[cnt++] = temp;
	}

	printf("%d\n",cnt );
	for(i=0;i<cnt;i++)
		printf("%d ",ans[i] );
	return 0;
}


/* P11- A DIFFERENCE ROW
	 Mauricio Tulio
      Jose Garcete  */

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

int funcion (const void * a, const void * b);	//prototipo de la funcion

int main()
{

    int v[1000],i,n,aux;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%d",&v[i]);
        qsort(v,n,sizeof(int),&funcion); // a=elemento inicial   n=tamano del arreglo	sizeof(int)= tamano de los datos de ese arreglo   funcion donde se compara

	    aux=v[n-1];		//cambio de posiciones variables una vez que se haya ordenado, segun pide el problema
        v[n-1]=v[0];
        v[0]=aux;

    for(i=0;i<n;i++)
        printf("%d ",v[i]);
        return 0;
}
int funcion (const void * a, const void * b)
{

   return ( *(int*)a - *(int*)b );   //retorna la diferencia de los valores de los punteros tipo entero a y b

}


//practice with dukkha
#include<stdio.h>
#include<string.h>
long long int fx(long long int a)
{
  //  printf("%lld\n",a);
	long long int k=0;
	int arr[20];
	int c=0;
	while(a!=0)
	{
		arr[c]=a%10;
		a/=10;
		c++;
	}
//	for(int i=0;i<c;i++)
//	printf("%d ",arr[i]);
//	printf("\n");
	for(int l=c-1;l>=0;l--)
		k=((k*10)+arr[l]);
//	printf("%lld\n",k);
	for(int l=0;l<c;l++)
		k=((k*10)+arr[l]);
//	printf("%lld\n",k);
	return k;
}
int main()
{
	long long int a,b;
	scanf("%lld %lld",&a,&b);
//	printf("%lld %lld\n",a,b);
	long long int sum=0;
//	printf("%lld\n",fx(100));
	for(long long int i=1;i<=a;i++)
	{
	   // printf("%lld\n",fx(i));
		sum+=fx(i);
		//sum%=b;
	}
	printf("%lld\n",sum%b);
	return 0;
}


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

int main(){

    int s,l;
    scanf("%d%d",&l,&s);

    int small[200],large[200];

    for (int j = 0; j <200 ; ++j) {
        small[j]=0;
        large[j]=0;
    }

    //nth member of small is nth digit of small number
    //1 based index

    //smallest number

    small[l]=1;

    int temp=s-1;
    int digit=1;

    while(temp>0 && digit<=l){

        small[digit]++;
        temp--;

        if(small[digit]==9) digit++;
    }

    if(s==0 && l==1) printf("0 ");
    else if(s==0 || s>9*l) printf("-1 ");
    else {
        for(int i=l;i>=1;i--) printf("%d",small[i]);
        printf(" ");
    }

    //largest number

    temp=s;
    digit=l;

    while(temp>0 && digit>=0){

        large[digit]++;
        temp--;

        if(large[digit]==9) digit--;
    }

    if(s==0 && l==1) printf("0 ");
    else if(s>9*l || s==0) printf("-1\n");
    else {
        for(int i=l;i>=1;i--) printf("%d",large[i]);
        printf("\n");
    }

    return 0;
}


#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d %d" , &a, &b);
    int x,n;
    n=a;
    while(a>=b)
    {
        n=n+(a/b);
        x=a%b;
        a=a/b;
        a=a+x;
    }
    printf("%d" , n);
    return 0;

}


#include<stdio.h>
#include<string.h>
int main()
{
int i;
char arr[20];
int c=0,b[20];
scanf("%s",arr);
for(i=0;i<strlen(arr);i++)
{
b[i]=arr[i];
if(b[i]>=53)
{
b[i]=57-b[i];
if(b[0]==0)
b[0]=9;
}
else
{b[i]=b[i]-48;}
printf("%d",b[i]);
}
//printf("1");
return 0;
}


#include<stdio.h>

int main()
{
    int n;
    while (scanf("%d",&n) != EOF)
    {

        if(n % 2 != 0)
            printf("Ehab\n");
        else
            printf("Mahmoud\n");
    }
    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)
char a[25];

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

}


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


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

int main() {

	int n;
	int a[20] = { 0 };
	int i;
	int chest = 0;
	int back = 0;
	int biceps = 0;

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

	for (i = 0; i < n; i += 3) {
		chest += a[i];
	}
	for (i = 1; i < n; i += 3) {
		biceps += a[i];
	}
	for (i = 2; i < n; i += 3) {
		back += a[i];
	}

	if (chest > biceps && chest > back) {
		printf("chest");
	} else if (biceps > chest && biceps > back) {
		printf("biceps");
	} else if (back > biceps && back > chest) {
		printf("back");
	}

	return 0;
}


#include <stdio.h>
#include <string.h>
int main(){
	int i,j,len;
	char mayor;
	char string[11];
	char res[11]={'\0'};

	scanf("%s" , string);

	len = strlen(string);
	mayor = string[0];

	for( i = 1 ; i < len; i++ ){
		if( string[i] > mayor ){
			mayor = string[i];
		}
	}

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

		if( string[i] == mayor ){

			j = 0;

			while( res[j] != '\0' ){
				j++;
			}

			res[j] = string[i];
			res[j+1] = '\0';
		}
	}

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


#include <stdio.h>
int main(){
int n;
scanf("%d",&n);
unsigned long long sum=0;
int i;
for (i=3; i <=n;i++ ){
    sum+=(i-1)*i;

}

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

}


#include <stdio.h>

int main()
{
    int n, count= 0, sum=0, i;
    scanf(" %d", &n);

    for(i=1; sum<n; i*=2)
    {
        sum+=i;
        count++;
    }
    printf("%d\n", count);

    return 0;
}


#include <stdio.h>

int main()
{
  int a1, a2, k1, k2, n, min, max, r, kmin, kmax, amin, amax;

  scanf("%d%d%d%d%d",&a1,&a2,&k1,&k2,&n);
  min = n-a1*(k1-1)-a2*(k2-1);
  if (min < 0) {
    min = 0;
  }
  if (k1 < k2) {
    kmin = k1;
    amin = a1;
    kmax = k2;
    amax = a2;
  }
  else {
    kmin = k2;
    amin = a2;
    kmax = k1;
    amax = a1;
  }
  max = n/kmin;
  if (max > amin) {
    max = amin;
    r = n-kmin*amin;
    max += r/kmax;
  }
  printf("%d %d\n",min,max);

  return 0;
}


#include <stdio.h>
#include <stdlib.h>
int main()
{
	char chess[8][8];
	int i,j,k;
	for(i=0;i<9;i++)
	{
		for(j=0;j<8;j++)
		{
			scanf("%c",&chess[i][j]);
		}
	}
	char variable[10]={'Q','R','B','N','P','q','r','b','n','p'};
	int value[10]={9,5,3,3,1,9,5,3,3,1};
	int black=0,white=0;
	for(i=0;i<9;i++)
	{
		for(j=0;j<8;j++)
		{
			for(k=0;k<10;k++)
			{
				if(chess[i][j]==variable[k])
				{
					if(k<5)
					{
						white+=value[k];
					}
					else
					{
						black+=value[k];
					}
				}
			}
		}
	}
	if(white>black)
		printf("White\n");
	else if(black>white)
		printf("Black\n");
	else
		printf("Draw\n");
	return 0;
}


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


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
int main(){
    int n,i;
    int a[55];
    int b[1005];
    int c[55];
    int j,count=0;
    memset(b,0,sizeof(b));
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    j=1;
    for(i=n;i>=1;i--){
        if(b[a[i]]!=1){
           c[j]=a[i];
           j++;
           b[a[i]]=1;
        }
    }
    count=0;
    for(i=1;i<=1003;i++){
        if(b[i]==1){
           count++;
        }
    }
    printf("%d\n",count);
    for(i=j-1;i>=1;i--){
        if(i==j-1){
           printf("%d",c[i]);
        }
        else{
           printf(" %d",c[i]);
        }
    }
    return 0;
}


#include<stdio.h>
int main()
{
    char str[100];
    int i, count = 0, n;
    scanf("%d", &n);
    scanf("%s", str);
    for(i = 0; i < n; i++)
    {
        if(str[i] == 'x' && str[i+1] == 'x' && str[i+2] == 'x')
            count++;
    }
    printf("%d", count);
}


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

int main(void)
{
//long int i,j;

long long int a,b; scanf("%lld",&a); scanf("%lld",&b);

long long int count=0;

while(a!=b)
{

if(a>b)
{
count += a/b;
a=a%b;

if(a==0)
break;
}

if(b>a)
{
count += b/a;
b=b%a;

if(b==0)
break;
}

}

printf("%lld",count);

return 0;
}


#include<stdio.h>
int main(){
    // lel
	int a;
	scanf("%d",&a);
	printf("%d",a+a/2);
	return 0;}


#include<stdio.h>

int main()
{
int k,n,s,p,a=0;
scanf("%d %d %d %d",&k,&n,&s,&p);
if(n%s==0)
n=n/s;
else
n=n/s+1;
k=k*n;
for(s=1;;s++)
{
a=a+p;
if(a>=k)
break;
}
printf("%d\n",s);
}


#include <stdio.h>

int main()
{
   char mi;
   char ma;
   while(scanf(" %c%c",&mi,&ma)!=EOF)
   {
       int n;
       int p;
       scanf("%d",&n);
       char s[200];
       int i,j;
       for(j=0;j<2*n;j=j+2)
       {
           scanf(" %c%c",&s[j],&s[j+1]);
           if(s[j]==mi&&s[j+1]==ma)
            p=1;
       }
       if(p==1)
       {
           printf("YES\n");
           p=0;
           continue;
       }
       for(i=0;i<2*n;i=i+2)
       {
           if(s[i+1]==mi)
           {
               for(j=0;j<2*n;j=j+2)
               {
                   if(s[j]==ma)
                    p=1;
               }
           }
       }
       if(p==1)
        {
           printf("YES\n");
           p=0;
        }
       else
        printf("NO\n");
   }
    return 0;
}


#include<stdio.h>
int main(){
  float vp,vd,t,f,c;
  float phm,d=0,time=0;
  int bijous=0;
  scanf("%f%f%f%f%f",&vp,&vd,&t,&f,&c);
  for(phm=t*vp;;){
    //printf("%f\n",phm);
    if(vd<=vp)
      break;
    phm+=phm*vp/(vd-vp);
    if(phm>=c)
      break;
    else{
      phm+=f*vp+(phm/vd)*vp;
      bijous++;
    }

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


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

int main() {
	long long int a,i,b;
	char s1[10001];
	char s2[10001];
	for(i=0;i<1001;i++)
	{
		s1[i]=' ';
		s2[i]=' ';
	}
	scanf("%s",s1);
	scanf("%s",s2);
	if(strcmp(s1,s2)==0)
	printf("%s\n",s2);
	else
	printf("1\n");
	return 0;
}


#include<stdio.h>
int main()
{
long long int c,marks,temp,a=1;
scanf("%lld",&marks);
temp=marks;
while(temp!=0)
{
   if(temp%a!=0)
   {
      break;
   }
   else
   a=a*3;
}
c=temp/a+1;
printf("%lld",c);
}


#include<stdio.h>

int main()
{
    int total;

    scanf("%d",&total);

    if( total<=10 || total>=22) // 10+11 is max
        printf("0\n");
    else
    {
        if( total == 20)
        {
                printf("15\n");
        }
        else
        {
            printf("4\n");
        }
    }
    return 0;

}
/****** PCCA -Fri Oct 07 12:57:29 GMT 2011 *******/


#include<stdio.h>
#include<string.h>
int main()
{
    int ara[8],ans,man[3500],i,j,k,sw=0,m,n=0,tst[8],pos[5],x,y;
    for(i=0;i<6;i++){
        scanf("%d",&ara[i]);
    }
    memset(tst,0,sizeof(tst));
    memset(man,0,sizeof(man));
    for(i=0;i<6;i++){
        tst[i]=1;
        for(j=0;j<6;j++){
            if(j!=i){
                tst[j]=1;
                for(k=0;k<6;k++){
                    if(k!=j && k!=i){
                        tst[k]=1;
                        for(m=0;m<6;m++){
                            if(tst[m]!=1){
                                pos[n]=m;
                                n++;
                            }
                        }
                        n=0;
                       x=ara[i]+ara[j]+ara[k];
                       y=ara[pos[0]]+ara[pos[1]]+ara[pos[2]];
                       if(x==y){
                        sw=1;
                        break;
                       }
                       tst[k]=0;
                    }
                }
                tst[j]=0;
            }

            if(sw==1){
                break;
            }
        }
        if(sw==1){
            break;
        }
        tst[i]=0;
    }
    if(sw==1){
        printf("YES\n");
    }
    else{
        printf("NO\n");

    }
    return 0;
}


#include<stdio.h>
#include<math.h>
int main ()
{
    int M,N,X;
    scanf("%d %d", &M, &N);
    X=((M*N)/2);
    printf("%d\n", X);
    return 0;
}

/* 1490302257089 */


#include <stdio.h>

int main(void) {
	int m,n,k,i=1,row,column,j=0,var,count=1;
	char pos;
	scanf("%d",&n);
	scanf("%d",&m);
	scanf("%d",&k);
	while(!(k<=2*i*m))
	{
		i++;
	}
	column =i;

	var=2*(column-1)*m+2;
	while(!(k<=var))
	{
		var+=2;
		count++;
	}
	row=count;
	if(k%2==0)
	pos='R';
	else
	pos='L';

printf("%d", column);
printf(" ");
printf("%d",row);
printf(" ");
printf("%c", pos);

	return 0;
}


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

int main()
{
	int i,temp=0,n,k,x,*arr;
	scanf("%d%d%d",&n,&k,&x);
	arr=malloc(n*sizeof(int));
	for(i=0;i<n;i++)
	{
		scanf("%d",&arr[i]);
	}
	for(i=n-k;i<n;i++)
	{
		arr[i]=x;
	}
	for(i=0;i<n;i++)
		temp+=arr[i];
	printf("%d\n",temp);
}


#include <stdio.h>

int main()
{
    int i, count = 0, n, x1, x2, result = 0, j;
    scanf("%d", &n);
    int ara[n][2];
    for(i = 0; i < n; i++) {
        scanf("%d %d", &ara[i][0] , &ara[i][1]);
    }
    for(i = 0; i < n; i++) {
        for(j = 0; j < n; j++) {
            if(ara[i][0] != ara[j][0] && ara[i][1] != ara[j][1]) {
                x1 = ara[i][0] - ara[j][0];
                x2 = ara[i][1] - ara[j][1];
                count++;
                break;
            }
        }
        if(count > 0) {
            break;
        }
    }
    result = x1*x2;
    if(count == 0 || n == 1) {
        printf("-1");
    }
    else {
        if(result < 0) {
            result = -1*result;
            printf("%d", result);
        }
        else {
            printf("%d", result);
        }
    }
    return 0;
}


#include <stdio.h>

int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	int a, b, c, d, t;

	scanf("%d%d%d%d", &a, &b, &c, &d);
	t = -1;
	if ((b - d) % gcd(a, c) == 0) {
		while (b != d)
			if (b < d)
				b += a;
			else
				d += c;
		t = b;
	}
	printf("%d\n", t);
	return 0;
}


#include <stdio.h>
int a,m,k,r;
int main() {
	scanf("%d",&a);
	scanf("%d",&m);
	r=a%m;
	while(k<20) {
		if(r%m==0) {
			printf("Yes\n");
			return 0;
		}
		else {
			r*=2;
			++k;
		}
	}
	printf("No\n");
	return 0;
}


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

void sort(int * arr, int size) {
    int i;
    if (size < 6) {
        int nSize = 0;
        while (size != 0) {
            nSize = 0;
            for (i = 0; i < size - 1; i++)
                if (arr[i] > arr[i + 1]) {
                    nSize = i + 1;
                    arr[i] ^= arr[i + 1];
                    arr[i + 1] ^= arr[i];
                    arr[i] ^= arr[i + 1];
                }
            size = nSize;
        }
        return;
    }
    int * tmp = (int *)calloc(size, sizeof(int));
    int lSize = (size >> 1);
    int rSize = size - lSize;
    sort(arr, lSize); sort(arr + lSize, rSize);
    int lPtr = 0, rPtr = 0;
    int ptr = 0;
    while (ptr != size) {
        if (lPtr == lSize)
            tmp[ptr] = arr[lSize + (rPtr++)];
        else if (rPtr == rSize || arr[lPtr] <= arr[lSize + rPtr])
            tmp[ptr] = arr[lPtr++];
        else
            tmp[ptr] = arr[lSize + (rPtr++)];
        ptr++;
    }
    for (i = 0; i < size; i++)
        arr[i] = tmp[i];
    free(tmp);
}

int main(void) {
    int n, i, t1, t2;
    scanf("%d ", &n);
    int arr1[n];
    int arr2[n];
    char c;
    for (i = 0; i < n; i++){
        scanf("%c", &c);
        arr1[i] = c - '0';
    }
    for (i = 0; i < n; i++){
        scanf("%c", &c);
        arr2[i] = c - '0';
    }
    sort(arr1, n);
    sort(arr2, n);
    t1 = 1;
    t2 = 1;
    for (i = 0; i < n; i++) {
        if (arr1[i] >= arr2[i])
            t1 = 0;
        if (arr1[i] <= arr2[i])
            t2 = 0;
    }
    printf("%s\n", (t1 || t2) ? "YES" : "NO");
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
    int l1,l2,c=0,j,k;
    char s1[101],s2[101];
    scanf("%s %s",s1,s2);
    l1=strlen(s1);
    l2=strlen(s2);
    for(j=0,k=l2-1; j<l1,k>=0; j++,k--) {
        if(s1[j]==s2[k]) {
            c++;
        }
    }
    if(l1==c) {
        printf("YES\n");
    }
    else {
        printf("NO\n");
    }
}


#include <stdio.h>

int main()
{
    int l,r;
    scanf("%d %d", &l, &r);
    long long a = 1, b = a, res = 0;
    while(a <= r) {
        while(b <= r) {
            if(b >= l) res++;
            b*=3;
        }
        a*=2;
        b = a;
    }
    printf("%I64d", res);
    return 0;
}


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


#include <stdio.h>

int main()
{
    int n, c, max = 0;
    int x[101] = {0}, v[101] = {0};

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

    for(int i = 0; i < n - 1; i++)
        if(x[i] > x[i + 1])
        {
            int temp = x[i] - x[i + 1];
            if(max < temp) max = temp;
            v[i] = 1;
        }

    printf("%d\n", max - c > 0? max - c : 0);

    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
    char str[105];
    int i,j,l,count=0,variable=0,cnt=0;
    scanf("%s",str);
    l=strlen(str);
    for(i=0;i<l-1;i++)
    {
        if(str[i]=='V' && str[i+1]=='K')
        {
            count++;
            str[i]='0';
            str[i+1]='0';
        }
    }
    for(i=0;i<l-1;i++)
    {
        if((str[i]=='V' && str[i+1]=='V') || (str[i]=='K' && str[i+1]=='K'))
        {
            variable=1;
        }
    }

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


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

int expmod(int a, int b, int n) {
  if(b == 0)
    return 1;
  else {
    long long res = expmod(a, b/2, n);
    res = (res*res) % n;
    if(b%2 == 1)
      res = (res*a) % n;
    return (int) res;
  }
}

int main()
{
    int n;
    unsigned long long int mod, i;
    mod = 1000000007;
    scanf("%d", &n);
    i = 1;

    int A = 0;
    int B = 1;
    while (i <=n){
       int nB = A * 3LL % mod;
        int nA = (A * 2LL + B) % mod;
        B = nB;
        A = nA;
        i++;
    }
    printf("%d\n", B);
    return 0;
}


#include <stdio.h>
int main(){
    int n,m,a[100],i,j,tr=1,min;
    scanf("%d",&n);
    for(i=0;i<n;i++)scanf("%d",&a[i]);
    while(tr){
              tr=0;
              min=a[0];
              for(i=1;i<n;i++)if(min>a[i])min=a[i];
              for(i=0;i<n;i++)if(a[i]>min){
                                           tr=1;
                                           a[i]-=min;
                                           }
              }
    m=0;

    for(i=0;i<n;i++)m+=a[i];
    printf("%d",m);
    return 0;
}


#include <stdio.h>

int main() {
	int i, n, m, cnt, sum;
	static int a[100];

	scanf("%d%d", &n, &m);
	sum = 0;
	for (i = 0; i < n; i++)
		scanf("%d", &a[i]);
	sum = 0;
	cnt = 1;
	for (i = 0; i < n; i++)
		if (sum + a[i] > m) {
			sum = a[i];
			cnt++;
		} else
			sum += a[i];
	printf("%d\n", cnt);
	return 0;
}


#include <stdio.h>
#include <ctype.h>
int max(int a,int b){if(a>b) return a; else return b;}
int main(){
   int i,n,m=0,w=0;
   scanf("%i",&n);
   getchar();
   for(i=0;i<n;i++)
   {
       char c=getchar();
       if(c == ' '){
           m = max(m,w);
           w = 0;
       }else if(isupper(c))
            w++;
   }
   m = max(m,w);
    printf("%i",m);
    return 0-0-0;
}


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


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

    int i, j, a, b;
	scanf("%d %d",&a,&b);
	char string[a], temp;
    scanf("%s",string);

    for (i=0; i<a-1; i++)
    {
        for (j=i+1; j<a; j++)
        {
            if (string[i] > string[j])
            {
                temp = string[i];
                string[i] = string[j];
                string[j] = temp;
            }
        }
    }

    int ar[a];
    for(i=0;i<a;i++)
    	ar[i]=string[i]-'a'+1;

    int sum=ar[0];
    int flag = 1;
    int temp2 = ar[0];
    for(i=1; i<a;i++){
    	if(flag==b)
			break;
    	if(ar[i]-temp2>1){
    		sum+=ar[i];
			temp2=ar[i];
			flag++;
		}
	}

	if(flag!=b)
		printf("-1");
	else
		printf("%d",sum);

    return 0;
}


#include <stdio.h>
int main()
{
    int di[10],n,n1,k,digit,count0,count;
    for(count0=0;count0<10;count0++) di[count0]=0;
    digit=1;
    count=count0=0;
    scanf("%d %d",&n,&k);
    n1=n;
    while(n1!=n1%10&&count0<k)
    {
        di[digit-1]=n1%10;
        digit++;
        if(n1%10==0) count0++;
        if(n1%10!=0) count++;
        n1=n1/10;
    }
    if(n==0) printf("%d",0);
    else if(k==count0) printf("%d",count);
    else if(count0<k&&count0==0) printf("%d",digit);
    else printf("%d",digit-1);
}


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

int main(void){
    int minuto=0,hora=0;
    char txt[5]={'0','0','0','0','0'}; //Inicializacion de la cadena que guarda el modelo HH:MM
    scanf("%s",&txt);//Carga de la hora en formato HH:MM
    getchar();
    fflush (stdin);
    hora=(txt[0]-'0')*10; //En la variable 'hora' se carga la decena de la hora introducida
    hora=hora+txt[1]-'0'; //Se carga la unidad de la hora en la variable 'hora' y se le suma a la decena extraida en la linea 10
    minuto=(txt[3]-'0')*10; //En la variable 'minuto' se carga la decena del minuto introducido
    minuto=minuto+txt[4]-'0'; //Se carga la unidad del minuto en la variable 'minuto' y se le suma a la decena extraida en la linea 12
    minuto++; //Aumentamos el minuto en uno por si se introdujo un hora capicua
   while(minuto>0)
    {
        if(minuto==60)//Si el minuto es 60 entonces agregamos sumamos 1 a hora y minuto vuelve a 0
        {
            minuto=0;
            hora++;
            if(hora==24) //Si hora es 24 se reinicia el reloj a la hora 00
            {
                hora=0;
            }
        }
        txt[0]=floor(hora/10)+'0';
        txt[1]=hora%10+'0';
        txt[3]=floor(minuto/10)+'0';
        txt[4]=minuto%10+'0';
        if(txt[0]==txt[4] && txt[1]==txt[3])
        {
            printf("%s",txt);
            break;
        }
        minuto++; //Contador de minuto
    }
}


#include <stdio.h>

int main()
{
    int w;
        scanf ("%d",&w);
        if(w!=2 && w%2==0)
        printf("YES\n");
        else{
        printf("NO\n");}
    return 0;
}
/* 1491891267270 */


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


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

int main()
{
   int n, i;
   char a[13][13]={{"January"}, {"February"}, {"March"}, {"April"}, {"May"}, {"June"}, {"July"}, {"August"}, {"September"}, {"October"}, {"November"}, {"December"}};
   scanf("%s %d", a[12], &n);
   for(i=0; i<12; i++)if(strcmp(a[12], a[i])==0)break;
   printf("%s", a[(i+n)%12]);
}


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

int gcd(int x,int y){
int i,f=1;
if (x>y){
    for (i=x;i>1;i--){
        if(x%i==0){
            if(y%i==0){
                f=i;
                break;
            }
        }
    }
}
if(y>x){
    for (i=y;i>1;i--){
        if(x%i==0){
            if(y%i==0){
                f=i;
                break;
            }
        }
    }
}
if (x==y){
    f=x;
}
return f;
}

int convert(int x,int y)
{
    int z=0;
    while(x>0)
    {
        z+=x%y;
        x=x/y;
    }
    return z;
    }

int main()
{
    int n,i,sum=0;
    scanf("%d",&n);
    for(i=2;i<n;i++)
    {
        sum+=convert(n,i);
    }
    int f=gcd(sum,n-2);
    if(f!=1)
    {
        sum/=f;
        n=n-2;
        n/=f;
        n=n+2;
    }
    printf("%d/%d",sum,n-2);
    return 0;
}


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

int main()
{
    int blocks,i=0;
    scanf("%d", &blocks);
    while(i*i<=blocks)
    {
        ++i;
    }
    --i;
    int szeleszama=4*i;//i*i s negyzet oldala
    if(blocks-i*i>i)
    {
        szeleszama+=4;
    }
    else if(blocks==i*i)
    {
        //nothing really xd
    }
    else
    {
        szeleszama+=2;
    }
    printf("%d",szeleszama);
    return 0;
}


//首先有一个1，接下来是0个，一个，两个4
/*interface*/
/*interface implementation*/
/*client*/
#define N 10
#include<stdio.h>
void print(int *a,int n) {
    int i;
    for(i=0; i<n; i++) {
        printf(" %d",a[i]);
    }
    printf("\n");
}
int main() {
    int n;
    scanf("%d",&n);
    //从头开始处理，
    //需要建立一个数组来保存这个整数的各个数位！
    //从尾巴开始处理，我们需要先统计4，再统计1,可以不需要建立数组！
    //两种方法我都处理一下！
    int is_magic=1;
    int digit[N];
    int nd=0;
    while(n>0 ) {
        digit[nd]=n%10;
	nd++;
        n/=10;
    }
    //print(digit,nd);
    int i;
    for(i=0; i<nd/2; i++) {
        int tmp=digit[i];
        digit[i]=digit[nd-1-i];
        digit[nd-1-i]=tmp;
    }
    //print(digit,nd);
    i=0;
    while(i<nd) {
        int counter=0;
        while(digit[i]==1 && i<nd) {
            i++;
            counter++;
        }
        //4前面至少有一个1
        if(counter==0) {
            is_magic=0;
            break;
        }
        //1后面必须是4而不是其他数！
        if(i<nd && digit[i]!=4) {
            is_magic=0;
            break;
        }

        counter=0;
        while(digit[i]==4 && i<nd) {
            i++;
            counter++;
        }
        //1后面可以有0个，1个，2个4，但是不能超过2个！
        if(counter>2) {
            is_magic=0;
            break;
        }
    }
    if(is_magic) printf("YES\n");
    else printf("NO\n");
    return 0;
}


#include <stdio.h>

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

    int arr[n];
    int tmp[n];

    int ones = 0;

    for (int i = 0; i < n; i++) {
        scanf("%d", arr + i);
        if (arr[i] == 1) {
            ones++;
        }
    }

    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;

    for (int i = 0; i < n; i++) {
        if (arr[i] == 1) {
            a++;
        } else {
            a--;
        }

        if (a > 0) {
            a = 0;
        } else if (b > a) {
            b = a;
            c = i;
        }

        tmp[i] = a;
    }

    d = c;

    while (d >= 0 && tmp[d] < 0) {
        d--;
    }

    if (c != d) {
        for (int i = d + 1; i <= c; i++) {
            if (arr[i] == 0) {
                ones++;
            } else {
                ones--;
            }
        }
    } else {
        if (arr[c] == 0) {
            ones++;
        } else {
            ones--;
        }
    }

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


#include<stdio.h>

typedef long long ll;
ll fox(ll a,ll b);
ll gcd(ll a,ll b);

int main()
{
  ll a,b,c,d;

  scanf("%lld%lld",&a,&b);

  d = (a>b)?gcd(a,b):gcd(b,a);

  c = fox(a/d,b/d);

  printf("%lld",c);

  return 0;

}

ll gcd(ll a,ll b)
{
 if(b==(ll)0)
   return a;

 return gcd(b,a%b);
}

ll fox(ll a,ll b)
{
 static ll count = (ll)0;
 ll larger,smaller;

 if(a==b)
   return count;

 count += (ll)1;

 if(a>b)
  {
    larger = a,smaller = b;
  }

 else
  {
    smaller = a,larger = b;
  }

 if(larger % (ll)2==(ll)0)
  {
   if(larger==a)
     a/=(ll)2;

   else
     b/=(ll)2;

   return fox(a,b);
  }

 else if(larger % (ll)3==(ll)0)
  {
   if(larger == a)
     a/=(ll)3;

   else
     b/=(ll)3;

   return fox(a,b);
  }

 else if(larger % (ll)5==(ll)0)
  {
   if(larger == a)
     a/=(ll)5;

   else
     b/=(ll)5;

   return fox(a,b);
  }

 else
   return -1;

}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char input[1000000];
scanf("%s",&input);
getchar();
int length=strlen(input),letter=length-1,numofzeroes=0,caseid;

if((length+1)%2==0)
caseid=0;
else
caseid=1;

while(input[letter]=='0'){
letter--;
numofzeroes++;
}

int done=0,front=0,back=letter;
while(done==0){

//printf("%d.%c %d.%c\n",front,input[front],back,input[back]);

if(input[front]!=input[back]){
done=1;
}
else if((length-numofzeroes)==1){
done=2;
}
else{
if(front==(((length-numofzeroes-caseid)/2)-(1-caseid))){
done=2;
}
front++;
back--;
}
}

if(done==2)
printf("YES");
else
printf("NO");

}


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

	int n;
	while(~scanf("%d",&n))
	{
		int pl1=1;
		int pl2=2;
		int flag=0;
		for(int i=1; i<=n; i++)
		{
			int win;
			scanf("%d",&win);
			if(win!=pl1&&win!=pl2)
				flag=1;
			if(flag);
			else
			{
				if(win==pl1)
					pl2=6-pl1-pl2;
				else
					pl1=6-pl1-pl2;
			}
		}
		if(flag)
			printf("NO\n");
		else
			printf("YES\n");
	}
}


#include<stdio.h>
#include<string.h>
#include<math.h>
int n,k;
int b[8];
char str[10];
char num[8][10];
void permu(char str[])
{
    int i,l,j,t,k,len;
    char c;
    len=strlen(str);
    for(j=1;j<len;j++)
        if(str[j-1]<str[j])
            i=j;
    for(k=0;k<len;k++)
        if(str[i-1]<str[k])
            l=k;
    c=str[i-1];str[i-1]=str[l];str[l]=c;
    for(j=i,t=len-1;j<=t;j++,t--)
    {
        c=str[j];
        str[j]=str[t];
        str[t]=c;
    }
}
int power(int x)
{
    int i,res=1;
    for(i=0;i<x;i++)
    res*=10;
    return res;
}
int arange(int i,char str[])
{
    int res,tmp,digit[9],j=0;
    res=0;
    for(j=0;j<k;j++)
        digit[j]=num[i][j]-'0';

    for(j=0;j<k;j++)
        res=res+power( k-(str[j]-'0') )*digit[j];

    return res;
}
int fact(int x)
{
    int res=1,i;
    for(i=1;i<=x;i++)
        res*=i;
    return res;
}
void Insert_sort(int X[])
{
    int j,p;
    int tmp;
    for(p=1;p<n;p++)
    {
        tmp=X[p];
        for(j=p;tmp<X[j-1]&&j>0;j--)
            X[j]=X[j-1];
        X[j]=tmp;
    }
}

int main()
{
    int i,tmp,max,j;
    scanf("%d%d",&n,&k);
    for(i=0;i<n;i++)
        scanf("%s",num[i]);
    for(i=0;i<k;i++)
        str[i]='0'+i+1;
    str[i]=0;
    max=1000000000;

    for(j=0;j<fact(k);j++)
    {
        for(i=0;i<n;i++)
            b[i]=arange(i,str);

        Insert_sort(b);

        tmp=b[n-1]-b[0];

        if(max>tmp)
            max=tmp;
        if(j<fact(k)-1)
                       permu(str);
    }

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

    return 0;
}


 #include<stdio.h>
int main ()
{
    long long int n,i,mul=0,j;
    scanf("%lld",&n);
    for(i=1;n!=0;i++)
    {
        j=n%2;
        if(j==1)
        {
        mul++;
        }
        n=n/2;
    }
    printf("%lld",mul);
    return 0;
}


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


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


#include<stdio.h>
main()
{
	int a,b,c,i,y;
	scanf("%d %d %d",&a,&b,&c);
	for(i=0;i<=c/a;i++)
	{
		y=(c-a*i);
		if(y%b==0)
		{
			printf("Yes");
			exit(0);
		}

	}
	printf("No");
}


#include<stdio.h>

int main(){
int a, b, c, temp, flag;
scanf("%d %d %d", &a, &b, &c);
	if(a==b){
		printf("YES");
	}

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

	else if(c==1){
		if(a<b){
			printf("YES");
		}
		else{
			printf("NO");
		}
	}

	else if(c==-1){
		if(a>b){
			printf("YES");
		}
		else{
			printf("NO");
		}
	}

	else{
		if(c>0){
			flag=1;
		}
		else{
			flag=2;
		}

		temp=a+c;
		while(temp!=b){
			temp=temp+c;
				if(flag==1){
					if(temp>b){
						printf("NO");
						break;
					}
				}

				else if(flag==2){
					if(temp<b){
						printf("NO");
						break;
					}
				}
		} /*end of while loop*/

		if(temp==b){
			printf("YES");
		}

	}

}


#include<stdio.h>

int main()
{
    int n, c=0, i;
    scanf("%d", &n);
    int j[n];
    for(i=1; i<=n; i++)
    {
        j[i]=(i*(i+1))/2;
        if(j[i]==n)
        {
            c++;
            break;
        }
    }
    if(c>=1)
        printf("YES\n");
    else
        printf("NO\n");

    return 0;
}


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


#include <stdio.h>

#include <string.h>

int main()

{

        char str[106];

        scanf("%s", str);

        int len = strlen(str);

        if(len < 7)

        {

               printf("no\n");

               return 0;

        }

        int j = 0;

        while(str[j] != '1' && str[j] != '\0')

               j++;

        //printf("%d\n", j);

        if(j == len)

        {

               printf("no\n");

               return 0;

        }

        int i, cnt = 0;

        for(i = j + 1; i < len; i++)

               if(str[i] == '0')

                       cnt++;

        //printf("%d\n", cnt);

        if(cnt > 5)

               printf("yes\n");

        else

               printf("no\n");

        return 0;

}


#include<stdio.h>

#define max(a,b)   a>b?a:b

int main()
{
    int n, c, i, p[10000], t[10000], l_p=0, r_p=0, time;
    scanf("%d %d",&n,&c);

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

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

    time=0;
    for(i=0; i<n; i++)
    {
        time+=t[i];
        l_p+=max(0,p[i]-c*time);
    }

    time=0;
    for(i=n-1; i>=0; i--)
    {
        time+=t[i];
        r_p+=max(0,p[i]-c*time);
    }

    if(l_p>r_p)
    {
        printf("Limak\n");
    }
    else if(r_p>l_p)
    {
        printf("Radewoosh\n");
    }
    else
    {
        printf("Tie\n");
    }
    return 0;
}


#include <stdio.h>

int main(){

	int n,ba,a,b,ro=1;
	scanf("%d %d %d",&n,&a,&b);
	ba=2;
	a--;
	b--;
	while(ba<=n){
		if(a/ba==b/ba)break;
		else{
			ba*=2;
			ro++;
		}
	}
	if(ba==n)printf("Final!\n");
	else printf("%d\n",ro);

	return 0;
}


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

//   问题描述： 输入2对参数， 一对是速度v1 v2，另外分别是时间 t 和 速度改变量 d
//    求在t时间内，走过的最大的路程
//   思路:
//      关键是求出最大速度
//

int v11[201];
int v22[201];
int v[201];

void near(int t, int d){
        int i;
        int j;

        for(i = 2; i < t; i ++){
                v11[i] = v11[i - 1] + d;
        }
        for(j = t - 1; j > 1; j --){
                v22[j] = v22[j + 1] + d;
        }

        for(i = 2; i < t; i ++){
                if(v11[i] > v22[i]){
                        v[i] = v22[i];
                }
                else{
                        v[i] = v11[i];
                }
        }
}

int main(){

        int v1;
        int v2;
        int t;
        int d;
        int i;
        int distance = 0;

        scanf("%d%d", &v1, &v2);
        scanf("%d%d", &t, &d);

        v11[1] = v1;
        v22[t] = v2;
        v[1] = v1;
        v[t] = v2;

        near(t, d);

        for(i = 1; i <= t; i ++){
                distance += v[i];
        }
        printf("%d\n", distance);

        return 0;
}


#include <stdio.h>
#include <string.h>
int main()
{
	int n,t;
	scanf("%d %d",&n,&t);
	char s[n];
	scanf("%s",s);
	int l=strlen(s),i,j;
	for (i=0; i<t; i++)
		for (j=l-2; j>=0; j--)
			if (s[j]=='B' && s[j+1]=='G')
			{
				s[j]='G';
				s[j+1]='B';
				j--;
			}
			//printf("%s\n",s);
	printf("%s\n",s);
	return 0;
}


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

int main (){

    int m,n,x=1;

    scanf("%d",&n);

    scanf("%d",&m);

    while(x<=m){

        m = m-x ;

        if(x != n){

            x++;

        }else{

            x=1;

        }

    }

    printf("%d",m);

return 0;
}


#include<stdio.h>
int main()
{
	long long int c=0,w,h,n,m;
	scanf("%lld %lld",&w,&h);
	if(w<2 || h<2)
	{
		printf("0\n");
		return 0;
	}
	for(n=2;w>=n;n=n+2)
	{
		for(m=2;h>=m;m=m+2)
			c=c+(h-(m-1))*(w-(n-1));
	}
	printf("%lld\n",c);
	return 0;
}


//
//  main.c
//  VK Cup 2017
//
//  Created by Georg on 04.03.17.
//  Copyright © 2017 Georg. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n, i, j;
    scanf("%d", &n);
    int years[n];
    for (i = 0; i < n; i++) {
        scanf("%d", &years[i]);
    }
    for (i = 0; i < n; i++) {
        for (j = 0 ; j < n; j++) {
            if (years[j] > years[i]) {

                years[i] = years[i] + years[j];
                years[j] = years[i] - years[j];
                years[i] = years[i] - years[j];
            }
        }
    }
//    for (i = 0; i < n; i++) {
//        printf("%d", years[i]);
//    }
    if (n == 1) {
        printf("%d", years[0]);
    } else if (n == 3) {
        printf("%d", years[1]);
    } else if (n == 5) {
        printf("%d", years[2]);
    }
    return 0;
}


#include <stdio.h>

int main() {
    int e,n,ans=0;
    scanf("%d%d",&e,&n);
    int max=e>n?e:n;
    int min=e<n?e:n;
    if(max>=2*min)
    {
        printf("%d",min);
    }
    else
    {
        int ans=(e+n)/3;
        printf("%d",ans);
    }
    return 0;
}


#include<stdio.h>
long long int fact[200005];
long long int modpow(long long int a, long long int n, long long int p)
{
	if (n < 0)
		return 0;
	long long int res = 1;
	while (n > 0)
	{
		if (n % 2 > 0)
			res = res * a % p;
		a = a * a % p;
		n /= 2;
	}
	return res;
}
long long int comb(long long int n, long long int r, long long int p)
{
	if (n < 0 || r < 0 || n < r)
		return 0;
	long long int res = fact[n];
	res = res * modpow(fact[r], p - 2, p) % p;
	res = res * modpow(fact[n - r], p - 2, p) % p;
	return res;
}
int main()
{
	long long int n, m;
	scanf("%lld %lld", &n, &m);
	long long int p = 998244353;
	long long int ans = 0;
	long long int i;
	fact[0] = 1;
	for (i = 1; i <= m; i++)
		fact[i] = fact[i - 1] * i % p;
	for (i = 1; i < m; i++)
		ans = (ans + comb(m - 1, n - 2, p) - comb(i - 1, n - 2, p) + p) % p;
	ans = ans * modpow(2, n - 3, p) % p;
	printf("%lld\n", ans);
	return 0;
}


#include<stdio.h>
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    k=240-k;
    if(k<5){
        printf("0");
        return 0;
    }
    int i=1;
    k=k-5*i;
    while(k>=0 && i<=n){

        i++;
        k=k-5*i;

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

    return 0;
}


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

    long long int a,b,c;
    scanf("%lld %lld",&a,&b);
    c=a/b;
    if (c%2==0)

    {
        printf("NO\n");
    }
    else printf ("YES\n");
    return 0;

}


#include <stdio.h>

typedef long long int LL;

const int NM=(int)(10e8+1);

int main(){
	int n,m;
	int i,j,k,s;
	int a,b;
	LL sum=0LL;
	int mas[11];
	int r[11];

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

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

	/*for(i=0;i<11;i++){
		printf("%d ",r[i]);

	}
	printf("\n");*/
	k=n;
	s=10;
	while(k>0 && s>0){
		if(r[s]>=k){
			sum+=(k*1LL*s);
			break;
		}
		sum+=(r[s]*1LL*s);
		k-=r[s];
		s--;
		//printf(":%I64d ",sum);
	}

	printf("%I64d",sum);

return 0;
}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    char a[11], b[11];
    scanf("%s%s", a, b);
    if(strlen(a)!=strlen(b))
    {
        printf("WRONG_ANSWER");
        return 0;
    }
    int n,m,q, dig[10],i;
    n=atoi(a);m=atoi(b);
    q=n;
    for(i=0;n!=0;i++)
    {
        dig[i]=n%10;
        n=n/10;
    }
    for(int j=0;j<i;j++)
    {
        for(int k=0;k<i-1;k++)
        {
            if(dig[k]>dig[k+1])
            {
                n=dig[k];
                dig[k]=dig[k+1];
                dig[k+1]=n;
            }
        }
    }
    for(int j=0;j<i;j++)
    {
        if(dig[j]!=0)
        {
            n=dig[0];
            dig[0]=dig[j];
            dig[j]=n;
            break;
        }
    }
    n=0;
    for(int j=0;j<i;j++)
    {
        n= n*10 + dig[j];
    }
    if(n==m)
        printf("OK");
    else
        printf("WRONG_ANSWER");
    return 0;
}


#include<stdio.h>
int gcd(int x,int y)
{int p;
 if(x>y)
 {
  for(int i=1;i<=y;i++)
  {
   if(x%i==0 && y%i==0)
   p=i;
  }
  return p;
 }
 else
 {
  for(int i=1;i<=x;i++)
  {
   if(x%i==0 && y%i==0)
   p=i;
  }
  return p;
 }
}
int main()
{
 int a,b,c,d,n,flag=0;
 scanf("%d %d %d",&a,&b,&n);
 c=a;
 d=b;
 for(;n!=0;)
 {
  a=a+gcd(c,n);
  n=n-gcd(c,n);
  if(n==0)
  {flag=1;
   break;}
  else
  {
   b=b+gcd(d,n);
   n=n-gcd(d,n);
  }}
  if(flag==1)
  printf("0\n");
  else
  printf("1\n");
  return 0;

}


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

int main() {
    int R,B,i,j;
    scanf("%d %d",&R,&B);
    int x[R],y[R],a[B],b[B];
    for(i=0;i<R;i++) {
        scanf("%d %d",&x[i],&y[i]);
    }
    for(i=0;i<B;i++) {
        scanf("%d %d",&a[i],&b[i]);
    }
    if(R!=B) {
        printf("NO");
    }else
        printf("YES");

    return 0;
}


#include <stdio.h>
int main()
{
    long long c[10] = { 6, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
    long long sum = 0;
    long long a, b, i;
    scanf( "%I64d %I64d", &a, &b );
    for( i = a; i <= b; ++i )
    {
        int j;
        j = i;
        if( j / 10 != 0 )
        while( j != 0  )
        {
            sum = sum + c[j % 10];
            j = j / 10;
        }
        else sum = sum + c[i];
    }
    printf("%d", sum);
}


#include<stdio.h>
int main()
{
	int n,k,i,total=0,give=0,check=0,day;
	scanf("%d %d",&n,&k);
	int a[n];
	for(i=0;i<n;++i)
	{
		scanf("%d",&a[i]);
		total+=a[i];
		if(total>8)
		{
			total-=8;
			give+=8;
		}
		else
		{
			give+=total;
			total=0;
		}
		if(give>=k&&check==0)
		{
			check=1;
			day=i+1;
		}
	}
	if(check==1)
	printf("%d",day);
	else
	printf("-1");
}


#include<stdio.h>
#include<math.h>
int main()
{
    int a,b,x,y;
    scanf("%d %d\n%d %d",&a,&b,&x,&y);
    if(abs(a-x)>abs(y-b))printf("%d",abs(a-x));
    else printf("%d",abs(y-b));
    return 0;
}


#include<stdio.h>
int main(){
    int w,h,i;
    scanf("%d %d",&w,&h);
    int ans=1;
    for(i=1;i<=w+h;i++)
        ans = (ans*2)%998244353;
    printf("\n%d",ans);
    return 0;
}


#include <stdio.h>
int max(int a, int b){
    int maxim;
    return maxim=(a>=b)?a:b;
}

int main(void)
{
    int a,b,c,d, misha, vasya;
    scanf("%d %d %d %d", &a,&b,&c,&d);
    misha = max((3*a)/10 ,a- ((a*c)/250));
    vasya = max((3*b)/10 ,b-((b*d)/250));
    if(misha>vasya) printf("Misha");
    else if(misha<vasya) printf("Vasya");
    else printf("Tie");

    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	char s[101];
	scanf("%s",s);
	int len = strlen(s);
	int i;
	int flag = 0;
	char *ans;
	ans = "CODEFORCES";
	for(i=0;i<len;i++)
	{
		char val[10];
		int j;
		int k;
		for(j=0;j<i;j++)
			val[j] = s[j];
		k = i;
		for(j=len - 10 +i;j<len;j++){
			val[k] = s[j];
			k++;
		}
		for(j=0;j<10;j++){
			if(val[j]== ans[j])
				flag = 1;
			else{
				flag = 0;
				break;
			}
		}
		if(flag == 1)
			break;
	}
	if(flag == 0)
		printf("NO\n");
	else
		printf("YES\n");
	return 0;
}


#include<stdio.h>

int main(){

int x , y;
scanf("%d %d",&x,&y);
if(x%2 == 0 && y%2 ==0)
printf("Malvika");
else if(x%2 ==1 && y%2 == 1)
printf("Akshat");
else if (x%2 ==1){
if (x<y)
printf("Akshat");
else
printf("Malvika");}
else if(y%2 ==1){
if(y<x)
printf("Akshat");
else
printf("Malvika");
}

return 0;
}


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

int main()
{
    int counter=-1,help=-1, last=-1, check=0, hello=0;
    char str[101];
    scanf("%s",str);
    for(int i=0; i<strlen(str); i++)
    {
        if(str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U' || str[i]=='Y')
        {
            help=i;
            if(help-counter > last)
             {
                 last=help-counter; counter=i;

             }
             else counter=i;
            check++; hello=i;
        }
         else if(i==strlen(str)-1 && (strlen(str)+1)-counter>last)
            {last=strlen(str)+-counter;}
    }
    if(check==1 && last<2) printf("%d", (strlen(str)-hello));
    else if(last==-1) printf("%d", strlen(str)+1);
    else printf("%d", last);
    return 0;
}


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


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

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

	int arr[n];
	int maxn = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &arr[i]);
		maxn = arr[i] > maxn ? arr[i] : maxn;
	}

	int maxgrp = 1;
	for (int i = 0; i < n; i++) {
		int cur = 0;
		for (int j = 0; j < n; j++) {
			if (arr[j] - arr[i] <= d && arr[j]-arr[i] >= 0) {
				cur++;
			}
		}
		maxgrp = cur > maxgrp ? cur : maxgrp;
	}

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


#include<stdio.h>
#include<string.h>
int main()
{
    int n,i,p=0,j=0;
    scanf("%d",&n);
    char s[n];
    scanf("%s",s);
    for(i=0;i<n;i++){
        if(s[i]=='S' && s[i+1]=='F'){
            p++;
        }
        else if(s[i]=='F' && s[i+1]=='S'){
            j++;
        }
    }
    if(p>j){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}


#include <stdio.h>
#include <stdlib.h>
int main(){
    int a[3];
    int b;
    scanf("%d%d%d", &a[0], &a[1], &a[2]);
    for (int i = 0; i < 3; i++)
        for (int j = 0; j < 3; j ++)
        if (a[i] < a[j])
        {
            b = a[i];
            a[i] = a[j];
            a[j] = b;
        }

    printf("%d", a[2] - a[0]);
    return 0;
}


#include <stdio.h>

int main()
{
	int m,n,t,u,maxi,i;
	scanf("%d %d",&m,&n);
	maxi=m;
	if (n>maxi){
		maxi=n;
	}
	t=6-maxi+1;
	u=6;
	for (i=6;i>1;i--){
		if (t%i==0 && u%i==0){
			printf("%d/%d",t/i,u/i);
			return 0;
		}
	}

	printf("%d/%d",t,u);

	return 0;
}


#include<stdio.h>
#define MOD 1000003

int power(int x,int y)
{
    if(y==0)
    return 1;
    int temp=x;
    while(--y)
    {
        x*=temp;
        x%=MOD;
    }
    return x;
}
int main()
{
    int y;
    scanf("%d",&y);
    if(y==0)
    {
    printf("%d",1);
    return 0;
    }
    int res=power(3,y-1);
    printf("%d\n",res);
    return 0;
}


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

int main()
{int t,s,q,r=0;
    scanf("%d %d %d",&t,&s,&q);
   while (s<t){
    s=s*q;
    r++;

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


#include<stdio.h>
int main(){
int n,m,f=1,i,j;
scanf("%d%d",&n,&m);
if(n==2){
    if(m==3) printf("YES");
    else printf("NO");
}

else{
    for(i=n+2;;i+=2){
    for(j=3;j<=i/2;j+=2){
        if(i%j==0){
            f=0;break;
        }
        else f=1;
    }
    if(f==1) break;
}
if(i==m) printf("YES");
else printf("NO");
}
return 0;
}


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

int main()
{
    int n,*a,i,max,ans;

    scanf("%d",&n);

    a = (int*)malloc(n*sizeof(int*));

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

    for(i=0;i<n;i++)
    {
        if(a[i]>max)
            max = a[i];
    }
    if(max>25)
        ans = max -25;
    else
        ans = 0;

    printf("%d",ans);
}


#include<stdio.h>
#define ll long long int
ll getcards(ll flo)
{
    return 3*flo*(flo+1)/2-flo;
}
//Another solution would be to calculate the number of rooms R i.e 3R-F everytime and then return the value.But it would become an O(n*sqrt(n));
int main()
{
    ll n;
    scanf("%lld",&n);

    ll floor;
    ll rem=0;
    for(floor=1;getcards(floor)<=n;floor++)
    {
        if((n+floor)%3==0)
            rem++;
    }

    printf("%lld",rem);

    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	char s[50],s1[50];scanf("%s",s);
	int i,l,t,cnt=0;
	l=strlen(s);
	if(l%2==0) t=l/2-1;
	else t=(l/2);
	for(i=0;i<l;i++)
	{
		s1[i]=s[t];
		cnt++;
		if(i%2==0)
			t=t+cnt;
		else
			t=t-cnt;

	}
	s1[l]='\0';
	printf("%s",s1);
    return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	char a[500],temp,max;
	int c,n,i,j,k,x,f=1,h=4,m;
	scanf("%s",a);
	scanf("%d",&k);
	c=0;
	n=strlen(a);
	while(c!=n)
	{
		max='0';
		for(j=c;j<k+c+1;j++)
		{
			if(j==n)
			break;
			if(a[j]>max)
			{
				max=a[j];
				x=j;
			}
		}
		for(j=x;j>c;j--)
		{
			/*if(c==x)
			break;*/
			if(k==0)
			{
				f=0;
				break;
			}
			temp=a[j-1];
			a[j-1]=a[j];
			a[j]=temp;
			k--;
		}
		c++;
	//	printf("%d ",k);
		if(f==0)
		break;
	}
	printf("%s",a);
	return 0;
}


#include <stdio.h>

int main()
{
    char n,i;
    long l,r,x,j;
    long min,max,sum,count=0;
    char s;
    scanf("%d%ld%ld%ld",&n,&l,&r,&x);
    long c[n];
    for(i=0;i<n;i++)
        scanf("%ld",c+i);
    long a=1L<<n;
    for(j=1;j<a;j++){
        min=1000000;
        max=1;
        sum=0;
        s=0;
        for(i=0;i<n;i++)
            if(j&(1L<<i)){
                if(c[i]<min)min=c[i];
                if(c[i]>max)max=c[i];
                sum+=c[i];
                s++;
            }
        if(s>1 && sum>=l && sum<=r && (max-min)>=x)
            count++;
    }
    printf("%ld\n",count);
    return 0;
}


#include<stdio.h>
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    printf("%d",a+b);
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    int d1,d2,d3,sum=0;
    scanf("%d %d %d",&d1,&d2,&d3);
    if(d1>d2){
    sum=sum+d2;
    if(d3<=d2+d1)
    sum=sum+d3;
    else
    sum=sum+d1+d2;
    if(d1<=d2+d3)
    sum=sum+d1;
    else
    sum=sum+d2+d3;
    }
    else
    {
        sum=sum+d1;
        if(d3<=d2+d1)
        sum=sum+d3;
        else
        sum=sum+d1+d2;
        if(d2<=d1+d3)
        sum=sum+d2;
        else
        sum=sum+d1+d3;
    }
    printf("%d",sum);
    return 0;
}