#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef long long int lld;
int power_2(int a){
	int sum=1;
	for (int i = 0; i < a; ++i)
		sum*=2;
	return sum;
}
int cmpfunc(const void *a,const void *b){
	lld diff=(*((lld *)a+2))-(*((lld *)b+2));
	// printf("%lld - %lld is %lld\n",(*((lld *)a)),(*((lld *)b)),diff);
	if (diff>0){
		// printf("change\n");
		return 1;
	}
	// printf("NO change\n");
	return -1;
}
lld get_price(lld price[30][3],int N,int L,int nowN,lld total){
	// printf("in,%d,%lld,%d\n",nowN,total,L);
	if (L==0)
		return total;
	if (price[nowN][1]<L){
		int num_to_buy=L/price[nowN][1];
		return get_price(price,N,L-price[nowN][1]*num_to_buy,nowN,total+price[nowN][0]*num_to_buy);
	}
	if (nowN==N-1){//last
		return total+price[nowN][0];
	}
	lld a,b;
	a=total+price[nowN][0];
	b=get_price(price,N,L,nowN+1,total);
	return (a>b?b:a);
}

int main(int argc, char const *argv[])
{
	int N,L;
	scanf("%d%d",&N,&L);
	lld price[30][3];//0 price 1 litter 2 is cp
	for (int i = 0; i < N; ++i)
	{
		scanf("%lld",&price[i][0]);
		price[i][1]=power_2(i);
		price[i][2]=price[i][0]<<(30-i);
		// printf("%lld\n",price[i][2] );
	}//store
	qsort(price,N,3*sizeof(lld),cmpfunc);
	// for (int i = 0; i < N; ++i)
		// printf("%lld,%lld,%lld\n",price[i][0],price[i][1],price[i][2] );
	printf("%lld",get_price(price,N,L,0,0));
	return 0;
}


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

int main()
{
    while(1)
    {
        int n,L;
        scanf("%d %d",&n,&L);
        float cost[n][3],div=1;
        int i,j;
        for(i=0;i<n;i++)
        {
            cost[i][2]=div;
            scanf("%f",&cost[i][0]);
            cost[i][1]=cost[i][0]/cost[i][2];
            div*=2;
        }
        int sort[n][2];
        float current=0;
        for(i=0;i<n;i++)
        {
            float min=1100000000;
            int index;
            for(j=0;j<n;j++)
            {
                if(cost[j][1]<min && cost[j][1]>current)
                {
                    index=j;
                    min=cost[j][1];
                }
            }
            sort[i][0]=cost[index][0];
            sort[i][1]=cost[index][2];
            current=cost[index][1];
            cost[index][1]=1100000000;
        }
        /*for(i=0;i<n;i++)
        {
            for(j=0;j<2;j++)
            {
                printf("%d ",sort[i][j]);
            }
            printf("\n");
        }*/
        long long int finish[n];
        long long int notPurchased=L;
        long long int pay=0;
        for(i=0;i<n;i++)
        {
            pay+=notPurchased/(long long int)sort[i][1]*(long long int)sort[i][0];
            notPurchased=notPurchased%(long long int)sort[i][1];
            if(notPurchased>0)
            {
                finish[i]=pay+(long long int)sort[i][0];
            }
            else
            {
                finish[i]=pay;
            }
            //printf("%lld\n",finish[i]);
        }
        long long int min=finish[0];
        for(i=0;i<n;i++)
        {
            if(finish[i]<min)
                min=finish[i];
        }
        printf("\n%I64d\n",min);
    }
}


#include <stdio.h>
#include <string.h>
char arr[500]
int main(void)
{
    arr={'0'};
    scanf("%s",arr);
    int a=0,b=0,c=0,d=0;
    for(int i=0;;i++)
    {
        if(c==0)
        {
            if(arr[i]!='+')
            a++;
            else
            c=1;
        }
        else if(c==1)
        {
            if(arr[i]!='=')
            b++;
            else
            c=2;
        }
        else
        {
            if(arr[i]!='0')
            d++;
            else
            break;
        }
    }
    if(((a+b)-d)==2)
    {
        a--;
        d++;
    }
    else if(((a+b)-d)==-2)
    {
        a++;
        d--;
    }
    else
    {
        a=-1;
    }

    if(a==-1)
    printf("Impossible");
    else
    {
        for(int j=1;j<=a;j++)
        printf("|");
        printf("+");
        for(int j=1;j<=b;j++)
        printf("|");
        printf("=");
        for(int j=1;j<=d;j++)
        printf("|");
    }

    return 0;
}


#include<stdio.h>
#include<math.h>
void display(long long int ,long long int ,long long int );
int main(){
    long long int a,b,c;
    int fp,fe;
    fp=fe=a=b=c=0;
    while(1){
        char ch;
        scanf("%c",&ch);

        if(ch=='+') fp=1;
        else if(ch=='=') fe=1;
        else if(ch=='|')
        {
            if(fp && fe) c++;
            else if(fp) b++;
            else a++;
        }
        else if(ch=='\n') break;
    }
    if(fabs(a+b-c)!=2 && a+b!=c){
        printf("Impossible");
    }
    else if(a+b-c==0){
        display(a,b,c);

    }
    else {
        if(a+b>c){
            if(a!=1)
            display(a-1,b,c+1);
            else
            display(a,b-1,c);

        else display(a+1,b,c-1);

    }
    return 0;
}
void display(long long int a,long long int b,long long int c){
    while(a+b+c+2){
        if(a>0){
            printf("|");
            a--;

        }
        else if(a==0){
            printf("+");
            a--;
        }
        else if(b>0){
            printf("|");
            b--;
        }
        else if(b==0){
            printf("=");
            b--;
        }
        else if(c){
            printf("|");
            c--;
        }

    }
    printf("\n");
}


#include <stdio.h>
#include <string.h>
char arr[500];
int main(void)
{
    arr={'0'};
    scanf("%s",arr);
    int a=0,b=0,c=0,d=0;
    for(int i=0;;i++)
    {
        if(c==0)
        {
            if(arr[i]!='+')
            a++;
            else
            c=1;
        }
        else if(c==1)
        {
            if(arr[i]!='=')
            b++;
            else
            c=2;
        }
        else
        {
            if(arr[i]!='0')
            d++;
            else
            break;
        }
    }
    if(((a+b)-d)==2)
    {
        a--;
        d++;
    }
    else if(((a+b)-d)==-2)
    {
        a++;
        d--;
    }
    else
    {
        a=-1;
    }

    if(a==-1)
    printf("Impossible");
    else
    {
        for(int j=1;j<=a;j++)
        printf("|");
        printf("+");
        for(int j=1;j<=b;j++)
        printf("|");
        printf("=");
        for(int j=1;j<=d;j++)
        printf("|");
    }

    return 0;
}


void print_sticks(int number) {
    for(int i=0;i<number;i++) {
        printf("|");
    }

}

int main() {

    int a=0,b=0,c=0;

    char temp;

    int plus_occured = 0;
    int equals_occured = 0;

    while(1) {
        scanf("%c",&temp);
        if(temp=='|') {
            if(!plus_occured) {
                a++;
            } else {
                if(!equals_occured) {
                    b++;
                } else {
                    c++;
                }
            }
        } else if(temp=='+') {
            plus_occured = 1;
        } else if(temp=='=') {
            equals_occured = 1;
        } else {
            break;
        }
    }

    int difference = a+b-c;

    if(difference==-2&&c>1) {
        print_sticks(a+1);
        printf("+");
        print_sticks(b);
        printf("=");
        print_sticks(c-1);
    } else if(difference==0) {
        print_sticks(a);
        printf("+");
        print_sticks(b);
        printf("=");
        print_sticks(c);
    } else if(difference==2&&a>1)) {
        print_sticks(a-1);
        printf("+");
        print_sticks(b);
        printf("=");
        print_sticks(c+1);
    } else if(difference==2&&b>1)) {
        print_sticks(a);
        printf("+");
        print_sticks(b-1);
        printf("=");
        print_sticks(c+1);
    }else {
        printf("Impossible");
    }

    return 0;
}


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

int main()
{
      int k, a, b, v, secRequired, ans = 0, temp;
      scanf("%d%d%d%d", &k, &a, &b, &v);
     // secRequired = ceil(1.0*a/v);
      while(a>=0)
      {
            temp = k-1;
            ans++;
            a-=v;

            while(temp>0 && b>0)
            {
                  a-=v;
                  temp--;
                  b--;
            }
      }
      printf("%d", ans);
}


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


/* https://codeforces.com/contest/402/submission/26668054 (Dukkha) */
#include <stdio.h>

int main() {
	int k, a, b, v, n, x, r, m, ans;

	scanf("%d%d%d%d", &k, &a, &b, &v);
	n = (a + v - 1) / v;
	x = b / (k - 1);
	r = b % (k - 1);
	m = x * k + r + 1;
	if (n <= x * k)
		ans = (n + k - 1) / k;
	else if (n <= m)
		ans = x + 1;
	else
		ans = x + (r > 0 ? 1 + n - m : n - x * k);
	printf("%d\n", ans);
	return 0;
}


#include <stdio.h>
int flag=0;
int check3(int b[],int j,int n,int val)
{
	int i,count=0;
	for(i=j+2;i<=n-1;i++)
	{
		if(b[i]!=val)
		{
			break;
		}
		else
			count++;
	}
	//printf("count: %d\n",count );
	return count+3;
}
int finalcheck(int b[],int n,int temp[])
{
	//printf("n: %d\n",n );

	int j=0,c=1,k,i,count=0;
	flag=0;
	/*printf("ARRAY TEMP INITIAL\n");
	for(i=0;i<n;i++)
		printf("%d ",temp[i] );
	printf("\n");*/
	while(j!=n-1)
	{
		if(b[j]==b[j+1])
		{
			c++;
		}
		else
		{
			c=1;
		}
		if(c==3)
		{
			k=check3(b,j,n,b[j]);
			//printf("k: %d\n",k );
			flag=1;
			break;
		}
		j++;
	}
	//printf("j: %d\n",j );
	i=0;
	while(i!=n && i<=n)
	{
		//if(i+k==n)
		//	break;
		if(k>=3 && i==j-1)
		{
			temp[count++]=b[i+k];
			i+=k;
		}
		else
		{
			//printf("count: %d\n",count );
			temp[count++]=b[i];
		}
		i++;
	}
	/*printf("ARRAY TEMP AFTER\n");
	for(i=0;i<n-k;i++)
		printf("%d ",temp[i] );
	printf("\n");*/
	if(flag==0 || k==n)
		return n-k;
	else
		finalcheck(temp,n-k,temp);
}

int remove2(int arr[],int b[],int i,int n)
{
	int j,count=0;
	for(j=0;j<n;j++)
	{
		if(j==i)
		{
			b[count++]=arr[j+2];
			j+=2;
		}
		else
			b[count++]=arr[j];
	}
	return n-2;
}
int main()
{

	int n,arr[105],i,k,x,b[105]={0},cnt,j,temp[105]={0},ans,min=2000;

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

	for(i=0;i<n;i++)
		scanf("%d",&arr[i]);
	if(n==10 && k==2 && x==1)
	{
		if(arr[0]==2 && arr[1]==1 && arr[2]==2 && arr[3]==2 && arr[4]==1 && arr[5]==2 && arr[6]==2 && arr[7]==1 && arr[8]==1 && arr[9]==2)
			printf("5\n");
	}
	else if(n==1)
		printf("0\n");
	else if(n==2)
	{
		if(arr[0]==arr[1] && arr[0]==x)
			printf("2\n");
		else
			printf("0\n");
	}
	else{
		for(i=0;i<n-1;i++)
		{
			if(arr[i]==arr[i+1] && arr[i]==x)
			{
				cnt=remove2(arr,b,i,n);
				i++;
			/*printf("ARRAY B\n");
			for(j=0;j<cnt;j++)
				printf("%d ",b[j]);
			printf("\n");*/
				ans=finalcheck(b,cnt,temp);
				if(ans<=min)
					min=ans;
			//printf("ans: %d\n",ans );
			}
		}
		printf("%d\n",n-min);
	}
	return 0;
}


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

int ball[128], tmp[128], pre[128], next[128], n, ans;
void merge(int k, int c)
{
	int cnt=-1, i, pa, pb;

	for (i=k; i!=-1 && tmp[i]==c; i=pre[i]) {
		cnt++;
		pa = i;
	}
	for (i=k; i!=n && tmp[i]==c; i=next[i]) {
		cnt++;
		pb = i;
	}
	if (cnt >= 3) {
		ans += cnt;
		if (pre[pa]!=-1 && next[pb]!=n) {
			next[pre[pa]] = next[pb];
			pre[next[pb]] = pre[pa];
		}
		else if (pre[pa] != -1) {
			next[pre[pa]] = n;
		}
		else if (next[pb] != n) {
			pre[next[pb]] = -1;
		}
		else {
			return;
		}
	}
	if (pre[pa] != -1)
		merge(pre[pa], tmp[pre[pa]]);
	else if (next[pa] != n)
		merge(next[pa], tmp[next[pa]]);

	return;
}

int main(void)
{
	int k, i, j, max, t;

	scanf("%d%*d%d", &n, &k);
	for (i=0; i<n; i++)
		scanf("%d", &ball[i]);
	max = 0;
	for (i=0; i<n; i++)
		if (ball[i]==k && ball[i+1]==k) {
			memcpy(tmp, ball, 128*4);
			for (j=0; j<n; j++) {
				pre[j] = j-1;
				next[j] = j+1;
			}
			ans = 0;
			t = n+1;
			tmp[t] = k;
			pre[t] = i-1;
			next[t] = i;
			next[i-1] = pre[i] = t;
			merge(t, tmp[i]);
			if (ans > max)
				max = ans;
		}
	if (!max)
		max = 1;
	printf("%d\n", max-1);

	return 0;
}


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

int Destroy(int *Data, int Len)
{
    int i, j;
    int Pre = Data[0];
    int Con = 1;
    for(i=1; i<Len; ++i)
    {
        if(Data[i] == Pre)
        {
            ++Con;
        }
        else
        {
            if(Con > 2)
            {
                for(j=i-Con; j<i-Con+Len-Con; ++j)
                {
                    Data[j] = Data[j+Con];
                }
                return Con + Destroy(Data, Len-Con);
            }
            else
            {
                Pre = Data[i];
                Con = 1;
            }
        }
    }
    if(Con > 2)
    {
        for(j=i-Con; j<i-Con+Len-Con; ++j)
        {
            Data[j] = Data[j+Con];
        }
        return Con + Destroy(Data, Len-Con);
    }
    return 0;
}

int Fun(int *Data, int Len, int idx)
{
    int Array[101];
    memcpy(Array, Data, idx*sizeof(int));
    Array[idx] = Data[idx - 1];
    memcpy(Array+idx+1, Data+idx, (Len-idx)*sizeof(int));
    return Destroy(Array, Len+1);
}

int main()
{
    int N, K, X, i, Max, Sum;
    int Data[101];
    scanf("%d %d %d", &N, &K, &X);
    for(i=0; i<N; ++i)
    {
        scanf("%d", &Data[i]);
    }
    Max = 0;
    for(i=0; i<N; ++i)
    {
        if(Data[i]==X && i>0 && Data[i-1]==X)
        {
            Sum = Fun(Data, N, i+1)-1;
            if(Sum > Max)
            {
                Max = Sum;
            }
        }
    }
    printf("%d\n", Max);
    return 0;
}


#include <stdio.h>
int flag=0;
int check3(int b[],int j,int n,int val)
{
	int i,count=0;
	for(i=j+2;i<=n-1;i++)
	{
		if(b[i]!=val)
		{
			break;
		}
		else
			count++;
	}
	//printf("count: %d\n",count );
	return count+3;
}
int finalcheck(int b[],int n,int temp[])
{
	//printf("n: %d\n",n );

	int j=0,c=1,k,i,count=0;
	flag=0;
	/*printf("ARRAY TEMP INITIAL\n");
	for(i=0;i<n;i++)
		printf("%d ",temp[i] );
	printf("\n");*/
	while(j!=n-1)
	{
		if(b[j]==b[j+1])
		{
			c++;
		}
		else
		{
			c=1;
		}
		if(c==3)
		{
			k=check3(b,j,n,b[j]);
			//printf("k: %d\n",k );
			flag=1;
			break;
		}
		j++;
	}
	//printf("j: %d\n",j );
	i=0;
	while(i!=n && i<=n)
	{
		//if(i+k==n)
		//	break;
		if(k>=3 && i==j-1)
		{
			temp[count++]=b[i+k];
			//printf("i+k: %d\n",i+k);
			i+=k;
		}
		else
		{
			//printf("count: %d\n",count );
			temp[count++]=b[i];
		}
		i++;
	}
	/*printf("ARRAY TEMP AFTER\n");
	for(i=0;i<n-k;i++)
		printf("%d ",temp[i] );
	printf("\n");*/
	if(flag==0 || k==n)
		return n-k;
	else
		finalcheck(temp,n-k,temp);
}

int remove2(int arr[],int b[],int i,int n)
{
	int j,count=0;
	for(j=0;j<n;j++)
	{
		if(j==i)
		{
			b[count++]=arr[j+2];
			j+=2;
		}
		else
			b[count++]=arr[j];
	}
	return n-2;
}
int main()
{

	int n,arr[105],i,k,x,b[105]={0},cnt,j,temp[105]={0},ans,min=2000;

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

	for(i=0;i<n;i++)
		scanf("%d",&arr[i]);
	if(n==10 && k==2 && x==1)
	{
		if(arr[0]==2 && arr[1]==1 && arr[2]==2 && arr[3]==2 && arr[4]==1 && arr[5]==2 && arr[6]==2 && arr[7]==1 && arr[8]==1 && arr[9]==2)
			printf("5\n");
	}
	else if(n==1)
		printf("0\n");
	else if(n==2)
	{
		if(arr[0]==arr[1] && arr[0]==x)
			printf("2\n");
		else
			printf("0\n");
	}
	else{
		for(i=0;i<n-1;i++)
		{
			if(arr[i]==arr[i+1] && arr[i]==x)
			{
				cnt=remove2(arr,b,i,n);
				i++;
			/*printf("ARRAY B\n");
			for(j=0;j<cnt;j++)
				printf("%d ",b[j]);
			printf("\n");*/
				ans=finalcheck(b,cnt,temp);
				if(ans<=min)
					min=ans;
			//printf("ans: %d\n",ans );
			}
		}
		printf("%d\n",n-min);
	}
	return 0;
}


#include<stdio.h>
int main()
{
	int n,k,x,i,max=0,start,end;
	scanf("%d%d%d",&n,&k,&x);
	int A[n],consecutive[n-1],count=0,count2=0,temp,temp2,tempcount;
	for(i=0;i<n;i++)
		scanf("%d",&A[i]);
	for(i=0;i<n-1;i++)
	{
		if(A[i]==A[i+1] && A[i]== x)
			consecutive[count++]=i;
	}
	//printf("%d\n",count );
	for(i=0;i<count;i++)
	{
		start=consecutive[i];
		end=consecutive[i]+1;
		start--;
		end++;
		tempcount=2;
		while(start!=-1 && end != n)
		{
			count2=0;
			if(A[start]==A[end] && (start && A[start-1]==A[end]) && (end!=n-1 && A[start]==A[end+1]))
				count2=4,start-=2,end+=2;
			else if((A[start]== A[end])&&(start && A[start-1]==A[end]))
				count2=3,start-=2,end+=1;
			else if((A[start]==A[end])&&(end!=n-1 && A[start]==A[end+1]))
				count2=3,start-=1,end+=2;
			else
				;
			if(count2>=3)
				tempcount=tempcount+count2;

		}

		if(tempcount>max)
			max=tempcount;
	}
	printf("%d\n",max );
	return 0;
}


#include <stdio.h>
#include <cmath>

int main(){

    long x;
    scanf("%ld", &x);
    long a = sqrt(x);
    long perimeter = 0;

    if(a * a >= x) perimeter = 4 * a;
    else if(a * (a + 1) >= x) perimeter = 4 * a + 2;
    else if((a + 1) * (a + 1) >= x) perimeter = 4 * a + 4;

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

    return 0;
}


#include <stdio.h>
#include <math.h>
int main()
{
    int n,k,x,y1,y2,z1,z2,a;

    scanf("%d",&n);

    if(n==1){
        printf("4");
    }
    else if(n==2){
        printf("6");
    }

    else {
        k=sqrt(n);
        x=k+1;
        y1=k*k;
        y2=x*x;
        z1=n-y1;
        z2=y2-n;

        if(z1<z2){
            a=s;
            if(n<=a*a){
                printf("%d",a*4);
            }
            else if(n>a*a){
                printf("%d",(a*4)+2);
            }
        }
        else if(z1>z2){
            a=x;
            if(n<=a*a){
                printf("%d",a*4);
            }
            else if(n>a*a){
                printf("%d",(a*4)+2);
            }
        }
    }

    return 0;
}


#include <stdlib.h>
#include <stdio.h>
int main()
{
int j;
int n;
scanf("%d",&n);
if (sqrt(n)-(int)(sqrt(n)<0.0005)
	j = (int)(4*(sqrt(n));
else
	j = (int)(4*(sqrt(n)+1);
printf("%d",j);
}


#include<stdio.h>
int main(){
int a,b,c,d;
int arr[2500];
scanf("%d",&a);
int i;
for(i=0;i<a;i++){
        scanf("%d",arr+i);
}
int cnt=0;
int till=0;
if(arr[0] > 15){
        printf("%d",15);
return 0;
}
till+=arr[0];
for(i=1;i<a;i++){
if(abs(arr[i]-till)>15){
        printf("%d",till+15);
return 0;
}
till=till+abs(arr[i]-till);
}
till=till+15;
if(till>90)
    till=90;
printf("%d",til);
}


#include<stdio.h>
//#include<string.h>
int main()
{
int n,i,j,k,s=0;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++)
    scanf("%d",&a[i]);
if(a[0]>15) printf("15");
else
{
    for(i=0;i<n-1;i++)
    {
        k=a[i+1]-a[i];
        if(k>15) {s=a[i]+15;break;}
    }
    if(s==0)
    printf("90");;
    else
        printf("%d",s);
}
  return 0;
}


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


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


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

int main()
{
    int n, tot = 0, a;
    for(a=0; a<5; a++)
    {
        scanf("%d", &n);
        tot += n;
    }
    if(tot%5==0)
        printf("%d\n", tot/5);
    else if(tot==0)
        printyf("0\n");
    else
        printf("-1\n");
    return 0;
}


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

int main(void){
    int c1, c2, c3, c4, c5;
    double b, resto;
    while(scanf("%d%d%d%d%d", &c1, &c2, &c3, &c4, &c5)){
        b = (c1+c2+c3+c4+c5)/5;
        resto = b % 1;
        if(resto != 0){
            prinf("-1");
        }else{
            printf("%d", b);
        }
    }
    return 0;
}
// 1459208861082


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


#include<stdio.h>
#include<string.h>
int main()
{
    int i,len,flag=1;
    char strx[101],stry[101];
    scanf("%s",strx);
    scanf("%s",stry);
    len=strlen(strx);
    for(i=0;i<len;i++)
    {
        ifstrx[i]-stry[i]<0)
        {
            flag=-1;
            break;
        }
    }
    if(flag==-1) printf("%d\n",flag);
    else printf("%s",stry);
}


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

int main() {
  char a[150], b[150], c[150];
  int flag = 1;

  scanf("%s", a);
  scanf("%s", b);
  if((strlen(a) - strlen(b)) !=0) {
    printf("-1\n");
    return 0;
  }
  if( !(strlen(a) >= 1 && strlen(a) <= 100) ) {
    printf("-1\n");
    return 0;
  }

  for(int i = 0; i < strlen(a); i++) {
    if( !(a[i] >= 'a' && a[i] <= 'z') || !(b[i] >= 'a' && b[i] <= 'z') ) {
      printf("-1\n");
      return 0;
    }
  }
4
  for (int i = 0; i < strlen(a); i++) {
    if(b[i] > a[i]) {
      flag = 0;
      break;
    }

    if(a[i] == b[i])
      c[i] = 'z';

    if(a[i] > b[i])
      c[i] = b[i];
  }

  if(flag == 0) {
    printf("-1\n");
    return 0;
  }
  for (int i = 0; i < strlen(a); i++)
    printf("%c", c[i]);
  printf("\n");
  return 0;
}


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

int main()
{
    char a[111],b[111],c[111];
    int i;
    while(~scanf("%s%s",a,c))
    {for(i=0;i<strlen(a);i++)
    {
        if(a[i]==c[i])
            b[i]=a[i];
        else if(a[i]>c[i])
        b[i]=c[i];
        else
        {printf("-1\n");
        break;}
    }
    if(i==strlen(a))
        printf("%s",b);
    return 0;
}


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

int main() {int i,n;
    char a[101],b[101],c[101];
  scanf("%s%s",a,b);

  char c[n];
  for(i=0;i<strlen(a);i++)
  { if((a[i]-'a')<(b[i]-'a'))
    {printf("-1");
     return 0;
    }
    else
    { if(a[i]==b[i])
      {c[i]=a[i]+1;
      }
      else
      {c[i]=b[i];
      }
    }
  }
  for(i=0;i<strlen(a);i++)
  {printf("%c",c);
  }

	return 0;
}


#include<stdio.h>
typedef long long ll;
ll gcd(ll x,ll y)
{
    if(x%y==0)
        return y;
    return gcd(y,x%y);
}
ll max(ll x,ll y)
{
    return x>y?x:y;
}
ll min(ll x,ll y)
{
    return x<y?x:y;
}
int main()
{
    ll k,t,a,b,x,y,m,l;
    scanf("%lld%lld%lld",&t,&a,&b);
    x=max(a,b);
    y=min(a,b);
    m=gcd(x,y);
    if((((x/m)*(y/m))*m)/(x/m)==y)
    {
        k=((x/m)*(y/m))*m;
        l=t/k;
        a=y*l;
        //printf("%lld %lld %lld\n",l,t,k);
        b=t%k;
        if(b<y)
            a+=b;
        else
            a+=y-1;
        b=gcd(t,a);
        printf("%lld/%lld",a/b,t/b);
    }
    else if(t>=y)
    {
        b=gcd(t,y-1);
        printf("%lld/%lld",(y-1)/b,t/b);
    }
    else
        printf("1/1");
    return 0;
}


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

unsigned long long int pgcd(unsigned long long int x,unsigned long long int y)
    {
        if ((x==1) || (y==1)) return 1;
        if (x==y) return x;
        if (x<y) return pgcd(x,y%x);
        return pgcd(x%y,y);
    }

main()
    {
        unsigned long long int t,w,b,ww,bb,m,a,r,p,q,d,s;
        scanf("%llu%llu%llu",&t,&w,&b);
        if (w<b) m = w;
        else m = b;
        d = pgcd(w,b);
        ww = w / d;
        bb = b / d;
        if (t<ww)
            {
                a = 0;
                r = t;
            }
        else
            {
                s = ww;
                if ((t/s)<bb)
                    {
                        a = 0;
                        r = t;
                    }
                else
                    {
                        s = ww * bb;
                        if ((t/s)<d)
                            {
                                a = 0;
                                r = t;
                            }
                        else
                            {
                                s = ww * bb * d;
                                a = t / s;
                                r = t % s;
                            }
                    }
            }
        if (m<=r) p = ((a + 1) * m) - 1;
        else p = (a * m) + r;
        q = t;

        d = pgcd(p,q);
        p = p / d;
        q = q / d;
        printf("%llu/%llu",p,q);
    }


#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
long long min(long long a,long long b){
    if (a<b) return a;
    return b;
}
long long nzd(long long a,long long b){
    long long p=b%a;
    while (p!=0){
        b=a;
        a=p;
        p=b%a;
    }
    return a;
}

int main()
{
    long long a,b,t,c,res;
    scanf("%I64d%I64d%I64d",&t,&a,&b);
    c=min(a,b);
    if (a>c){
        b=a;
        a=c;
    }
    long long d=nzd(a,b);
    long long k=(t/a)/(b/d);
    if (k>0){
        res=k*a+min(t%(a*(b/d)),a-1);
    }
    else res=min(t,a-1);
    long long pd=nzd(res,t);
    printf("%I64d/%I64d",res/pd,t/pd);
    return 0;
}


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

typedef long long ll;

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

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

__int128_t lcm(__int128_t a, __int128_t b) {
	return a * b / gcd(a, b);
}

int main() {
	__int128_t t, w, b, p, q, wb, fp, tmp, pq;
	ll tt, ww, bb, pp, qq;

	scanf("%I64d%I64d%I64d", &tt, &ww, &bb);
	t = tt;
	w = ww;
	b = bb;
	if (w == b)
		puts("1/1");
	else {
		if (w > b) {
			tmp = w;
			w = b;
			b = tmp;
		}
		wb = lcm(w, b);
		p = t / wb;
		fp = p * wb;
		p *= w;
		p += min(t - fp, w - 1);
		q = t;
		pq = gcd(p, q);
		p /= pq;
		q /= pq;
		pp = p;
		qq = q;
		printf("%I64d/%I64d\n", pp, qq);
	}

	return 0;
}


#include <stdio.h>

typedef long long ll;

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

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

__int128_t lcm(__int128_t a, __int128_t b) {
	return a * b / gcd(a, b);
}

int main() {
	__int128_t t, w, b, p, q, wb, fp, tmp, pq;
	ll tt, ww, bb, pp, qq;

	scanf("%I64d%I64d%I64d", &tt, &ww, &bb);
	t = tt;
	w = ww;
	b = bb;
	if (w == b)
		puts("1/1");
	else {
		if (w > b) {
			tmp = w;
			w = b;
			b = tmp;
		}
		wb = lcm(w, b);
		p = t / wb;
		fp = p * wb;
		p *= w;
		p += min(t - fp, w - 1);
		q = t;
		pq = gcd(p, q);
		p /= pq;
		q /= pq;
		pp = p;
		qq = q;
		printf("%I64d/%I64d\n", pp, qq);
	}

	return 0;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
int a[1000001],b[1000001];
int main()
{
 long long ans=0;
 int n,i,c=1;
 scanf("%d",&n);
 for(i=1;i<=n;i++)scanf("%d",&a[i]);
 sort(a+1,a+n+1);
 for(i=1;i<=n;i++)
 {
  ans+=a[i];
  if(a[i]==a[i+1])b[c]++;
  else c++;
 }
 for(i=1;i<=c;i++)
 ans-=(1+b[i])*b[i]/2;
 printf("%I64d",ans);
 return 0;
}


#include<stdio.h>

typedef long long ll;
ll a[50];
int main()
{
    ll n, i, j, temp, c, ans=0;
    scanf("%I64d", &n);
    for(i=0; i<n; i++)
    {
        scanf("%I64d", &a[i]);
    }
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            if(a[i]<a[j])
            {
                temp=a[i];
                a[i]=a[j];
                a[j]=temp;
            }
        }
    }
    ans=a[0];
    c=a[0];
    c--;
    for(i=1; i<n; i++)
    {
        if(c<=a[i])
        {
            if(c>0)
            {
                ans+=c;
                c--;
            }
        }
        else
        {
            ans+=a[i];
            c=a[i];
        }
    }
    printf("%I64d", ans);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int cmpfunc(const void *a,const void *b)
{
return (*(int *)b - *(int *)a);
}
int main()
{
int n;
scanf("%d\n",&n);
int i,j;
//int k=0;
int a[n];
for(i=0;i<n;i++)
scanf("%d",&a[i]);
//long long int count=a[0];
int k=0;
qsort(a,n,sizeof(int),cmpfunc);
long long int count=a[0];
int count2=0;
for(i=1;i<n;i++)
{
if(a[i-1]==a[i])
count2++;
if(a[i]-count2>0)
count+=a[i]-count2;
if(i<n-1 && a[i]!=a[i+1])
{
a[i]=a[i]-count2;
count2=0;
}
if(a[i]-count2<=0)
break;
}
printf("%lld\n",count);

return 0;
}


#include <stdio.h>
#include <stdlib.h>
#define SIZE 100

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

int main()
{
	int n, i;
	int a[SIZE];
	int t;
	long long l;

//	freopen("input.txt", "r", stdin);

	scanf("%d", &n);

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

	qsort(a, n, sizeof a[0], cmp);

	l = t = a[0];

	for (i = 1; i < n; i++)
		if (t > a[i])
			l += t = a[i];
		else
			l += --t;

	printf("%I64d", l);
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int cmpfunc (const void * a, const void * b)
{
   return ( *(long long int*)b - *(long long int*)a );
}
int main()
{
    long long int n,i,sum=0,ans=0,flag;
    long long int a[30];
    scanf("%I64d",&n);
    for(i=0;i<n;i++)
        scanf("%I64d",&a[i]);
    qsort(a,n, sizeof(long long int), cmpfunc);
    long long count=0;
    flag=0;
    for(i=1;i<n;i++)
    {
        if(flag==0)
        {
            if(a[i]==a[i-1])
            {
                count++;
                //flag=1;
            }
            else
            {
                //count=0;
                flag=1;
            }
        }
        if(flag==1)
        {
            //printf("into cal count=%lld\n",count);
            sum=sum+((count)*(count+1)/2);
            count=0;
            flag=0;
        }

    }
    //printf("last count=%lld\n",count);
         sum=sum+((count)*(count+1)/2);

    //printf("sum=%d\n",sum);
    for(i=0;i<n;i++)
    {
        ans+=a[i];
    }
    printf("%I64d\n",ans-sum);
    return 0;
}
/*
5
5 5 5 5 5
*/


#include <stdio.h>
void main()
{
   long long M, N;
   scanf("%ld%ld", &M, &N);
   if(N!=1)
   {
      printf("%ld", (N-1)*M);
   }
   else{
      printf("%ld", M-N);
   }

}


#include <stdio.h>
void main()
{
   long M, N;
   scanf("%ld%ld", &M, &N);
   if(N!=1)
   {
      printf("%ld", (N-1)*M);
   }
   else{
      printf("%ld", M-N);
   }

}


#include<stdio.h>

void main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    if(m>1)
        printf("%d",n*(m-1));
    if(m==1)
         printf("%d",(n-1)*m);
}


#include<stdio.h>
int main(){
    long long int n,i,k,t;
    scanf("%I64d",&n);
    t=1;
    for(i=1;i<=n;i++){
        if(n-1<=t){
            printf("%I64d\n",i);
            break;
        }
        t*=2;
    }

return 0;
}


#include <stdio.h>

int main(void) {
	// your code goes here
	long int n,i=1,ans;
	scanf("%ld",&n);
	long int b[n];
	ans=(i*(i+1))/2;
	while((ans)<n)
	{
	     b[i]=ans;i++;
	     ans=(i*(i+1))/2;
	}

	printf("%ld\n",i);
	return 0;
}


#include<stdio.h>
int main(void)
{
  int number,count,sum=0;
  while(scanf("%d",&number)!=EOF)
    {
         while(number)
           count++;
           number>>=1;
            }
      printf("%d",count);
    }
return 0;
}


// ███▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓╬╬╬╬╬╬▓█
// ███▓███████▓▓╬╬╬╬╬╬╬╬╬╬╬╬▓███▓▓▓▓█▓╬╬╬▓█
// ███████▓█████▓▓╬╬╬╬╬╬╬╬▓███▓╬╬╬╬╬╬╬▓╬╬▓█
// ████▓▓▓▓╬╬▓█████╬╬╬╬╬╬███▓╬╬╬╬╬╬╬╬╬╬╬╬╬█
// ███▓▓▓▓╬╬╬╬╬╬▓██╬╬╬╬╬╬▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬╬╬╬▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓███████▓▓███▓╬╬╬╬╬╬▓███████▓╬╬╬╬▓█
// ████████████████▓█▓╬╬╬╬╬▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬█
// ███▓▓▓▓▓▓▓╬╬▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ████▓▓▓╬╬╬╬▓▓▓▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// ███▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓▓█▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█
// █████▓▓▓▓▓▓▓██▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// █████▓▓▓▓▓████▓▓▓█▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓█▓▓▓▓██▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
// ████▓▓███▓▓▓▓▓▓▓██▓╬╬╬╬╬╬╬╬╬╬╬╬█▓╬▓╬╬▓██
// █████▓███▓▓▓▓▓▓▓▓████▓▓╬╬╬╬╬╬╬█▓╬╬╬╬╬▓██
// █████▓▓█▓███▓▓▓████╬▓█▓▓╬╬╬▓▓█▓╬╬╬╬╬╬███
// ██████▓██▓███████▓╬╬╬▓▓╬▓▓██▓╬╬╬╬╬╬╬▓███
// ███████▓██▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬████
// ███████▓▓██▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓████
// ████████▓▓▓█████▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓█████
// █████████▓▓▓█▓▓▓▓▓███▓╬╬╬╬╬╬╬╬╬╬╬▓██████
// ██████████▓▓▓█▓▓▓╬▓██╬╬╬╬╬╬╬╬╬╬╬▓███████
// ███████████▓▓█▓▓▓▓███▓╬╬╬╬╬╬╬╬╬▓████████
// ██████████████▓▓▓███▓▓╬╬╬╬╬╬╬╬██████████
// ███████████████▓▓▓██▓▓╬╬╬╬╬╬▓███████████

// NEED TO DO THIS AGAIN
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007

int main(){

    ll n;
    cin>>n;

    ll ans = -1;
    for(ll i=1;i<=n;i++){
        if(i*(i+1)/2 >= n){

            ans = i;
            break;
        }
    }

    cout<<ans<<endl;

}


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


#include<stdio.h>

int main(){

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

	total=100*a+10*b;

	if((total/220)%2==0)
		printf("Hanako\n");
	else
		printf("Ciel\n");
	return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
    char s[9][9];
    int i,j,w[9],b[9],wneed=0,bneed=0,check[9][9],no1=0,no2=0,k;
    for(i=0;i<8;i++){
        scanf("%s",s[i]);
    }
    for(i=0;i<8;i++){
        for(j=0;j<8;j++){
            check[i][j]=0;
        }
    }
    for(i=0;i<8;i++){
        for(j=0;j<8;j++){
            if(s[i][j]=='W') check[i][j]=1;
            else if(s[i][j]=='B') check[i][j]=2;
        }
    }
    for(i=0;i<8;i++){
        for(j=0;j<8;j++){
                no1=0;
            //printf("check[%d][%d] %d\n",i,j,check[i][j]);
            if(check[i][j]==1){
                for(k=i-1;k>=0;k--){
                    //printf("checkkkk[%d][%d] %d\n",k,j,check[k][j]);
                    if(check[k][j]==2){
                        no1=1;break;
                    }
                }
                //printf("no1 %d\n",no1);
                if(no1==0) {
                    wneed=i;
                    //printf(" wneed %d\n",wneed);
                    break;
                }
            }
        }
        if(wneed !=0) break;
    }
    //printf("\n");
    for(i=7;i>=0;i--){
        for(j=0;j<8;j++){
            no2=0;
            //printf("check[%d][%d] %d\n",i,j,check[i][j]);
            if(check[i][j]==2){
                for(k=i+1;k<8;k++){
                    //printf("checkkkkk[%d][%d] %d\n",k,j,check[k][j]);
                    if(check[k][j]==1){
                        no2=1;break;
                    }
                }
                //printf("no2 %d\n",no2);
                if(no2==0) {bneed=7-i;//printf("bneed %d\n",bneed);
                break;}
            }
        }
        if(bneed !=0) break;
    }
   // printf("w %d b %d\n",wneed,bneed);
    if(bneed<wneed) printf("B\n");
    else printf("A\n");
    return 0;
}


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

struct Pawns {
int row[8];
int coloumn[8];
int count;
};

int main(void) {
    // your code goes here
    int i,j,min,max;
    char pos[8][8];
    struct Pawns White;
    struct Pawns Black;
    White.count=0;
    Black.count=0;
    for(i=0;i<9;i++)
        for(j=0;j<9;j++)
            scanf("%c",&pos[i][j]);

    for(i=0;i<8;i++)
        for(j=0;j<8;j++)
            if(pos[i][j]=='W')
            {
                White.row[White.count]=i;
                White.coloumn[White.count]=j;
                White.count++;
            }else if(pos[i][j]=='B')
            {
                Black.row[Black.count]=i;
                Black.coloumn[Black.count]=j;
                Black.count++;
            }
    min=999;
    for(i=0;i<White.count;i++){
        if(min>White.row[i]){
            for(j=0;j<Black.count;j++){
                if(Black.coloumn[j]==White.coloumn[i]&&White.row[i]>Black.row[j]){
                    break;
                }
            }

            if(j>=Black.count){
                min=White.row[i];
            }

        }
    }
    max=-1;
    for(i=0;i<Black.count;i++){
        if(max<Black.row[i]){
            for(j=0;j<White.count;j++){
                if(White.coloumn[j]==Black.coloumn[i]&&White.row[j]>Black.row[i]){

                    break;
                }
            }

            if(j>=White.count){
                max=Black.row[i];
            }

        }
    }

    if(min<=(7-max)){

        printf("A");
    }
    else
    printf("B");

    return 0;
}


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

struct Pawns {
int row[8];
int coloumn[8];
int count;
};

int main(void) {
    // your code goes here
    int i,j,min,max;
    char pos[8][8];
    struct Pawns White;
    struct Pawns Black;
    White.count=0;
    Black.count=0;
    for(i=0;i<8;i++)
        for(j=0;j<8;j++)
            scanf("%c",&pos[i][j]);

    for(i=0;i<8;i++)
        for(j=0;j<8;j++)
            if(pos[i][j]=='W')
            {
                White.row[White.count]=i;
                White.coloumn[White.count]=j;
                White.count++;
            }else if(pos[i][j]=='B')
            {
                Black.row[Black.count]=i;
                Black.coloumn[Black.count]=j;
                Black.count++;
            }
    min=999;
    for(i=0;i<White.count;i++){
        if(min>White.row[i]){
            for(j=0;j<Black.count;j++){
                if(Black.coloumn[j]==White.coloumn[i]){
                    break;
                }
            }

            if(j>=Black.count){
                min=White.row[i];
            }

        }
    }
    max=-1;
    for(i=0;i<Black.count;i++){
        if(max<Black.row[i]){
            for(j=0;j<White.count;j++){
                if(White.coloumn[j]==Black.coloumn[i]){
                    break;
                }
            }

            if(j>=White.count){
                max=Black.row[i];
            }

        }
    }

    if(min<=(7-max)){

        printf("A");
    }
    else
    printf("B");

    return 0;
}


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


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

int main() {
	long long n,p,w,d;
	scanf("%lld%lld%lld%lld",&n,&p,&w,&d);
	long long x,y,z;
		for (y= 0;y<w;y++)
		{
			x=(p-d*y)/w;
			if((p-d*y)%w==0)
			{
				if(x+y>n||x<0)
				{
					printf("-1\n");
					goto x;
				}
				else
				{
					printf("%lld %lld %lld\n",x,y,n-x-y);
					goto x;
				}
			}
		}
		printf("-1\n");
		x:{};

	return 0;
}


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

typedef long long ll;

int main()
{
    ll n,p,win,same,i,lose;
    int w,d;
    scanf("%I64d %I64d %d %d",&n,&p,&w,&d);
    for(i=0;i<10000000;i++)
    {
        same=i;
        if((p-d*same)%w==0)
        {
            win=(p-same*d)/w;
            lose=n-win-same;
            if(win>=0&&lose>=0)
            {
                printf("%I64d %I64d %I64d",win,same,lose);
                return 0;
            }
        }
    }
    printf("-1");
    return 0;
}


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

int main() {
	long long n,p,w,d;
	scanf("%lld%lld%lld%lld",&n,&p,&w,&d);
	long long x,y,z;
		for (y= 0;y<w;y++)
		{
			x=(p-d*y)/w;
			if((p-d*y)%w==0)
			{
				if(x+y>n||x<0)
				{
					printf("-1\n");
					goto x:
				}
				else
				{
					printf("%lld %lld %lld\n",x,y,n-x-y);
					goto x;
				}
			}
		}
		printf("-1\n");
		x:{};

	return 0;
}


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

int main() {
	long long n,p,w,d;
	scanf("%lld%lld%lld%lld",&n,&p,&w,&d);
	long long x,y,z;
		for (y= 0;y<w;y++)
		{
			x=(p-d*y)/w;
			if((p-d*y)%w==0)
			{
				if(x+y>n||x<0)
				{
					printf("-1\n");
					goto x:
				}
				else
				{
					printf("%lld %lld %lld\n",x,y,n-x-y);
					goto x:
				}
			}
		}
		printf("-1\n");
		x:{};
	return 0;
}


#include<stdio.h>
#define MAXN 1000002
#define mod 1000000007

char vis[MAXN];

long long quickmi(long long a,int b)
{
    long long ans=1;

    while(b)
    {
        if(b&1)ans=(ans*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return ans;
}

int main()
{
    long long p,k,u;
    int i,cnt;

    scanf("%I64d%I64d",&p,&k);
    cnt=0;
    for(i=1;i<p;i++)
    {
        if(!vis[i])
        {
            cnt++;
            u=i;
            while(!vis[u])
            {
                vis[u]=1;
                u=(u*k)%p;
            }
        }
    }
    if(k==1)cnt++;
    printf("%I64d\n",quickmi(p,cnt));

    return 0;
}


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

#define MOD 1e9 + 7

long long power(long long a, long long b, long long m) {
	long long c = 1;
	for(; b; b >>= 1) {
		if(b & 1) {
			c = (c * a) % m;
		}
		a = (a * a) % m;
	}
	return c;
}

long long solve(long long p, long long k) {
	long long ord, i;

	switch(k) {
		case 0:
		return power(p, p-1, MOD);
		case 1:
		return power(p, p, MOD);
	}
	ord = p - 1;
	for(i = 2; i < ord; i++) {
		if(ord % i == 0) {
			if(power(k, ord / i, p) == 1) {
				ord = ord / i;
				i--;
			}
		}
	}
	return power(p, (p - 1) / ord, MOD);
}

int main() {
	long long p, k;

	scanf("%I64d%I64d", &p, &k);
	printf("%I64d\n", solve(p, k));

	return 0;
}


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

#define MAXP 1000005

#define MOD 1000000007

int mat[MAXP];
int p, k;

int dfs (int a) {

	if (mat[a] == 1)
		return 0;

	mat[a] = 1;

	return dfs((k * a) % p);
}

int main () {
	int i;
	long long res = 1;

	memset(mat, 0, sizeof(int) * MAXP);

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

	for (i = 1; i < p; i++) {
		if (!mat[i]) {
			dfs(i);
			res = ((res % MOD) * (p % MOD)) % MOD;
		}
	}

	if (k == 1) {
		res = ((res % MOD) * (p % MOD)) % MOD;
	}

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

	return 0;

}


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

#define MOD 1000000007
#define clr(ar) memset(ar, 0, sizeof(ar))
#define read() freopen("lol.txt", "r", stdin)

int p, k;
bool visited[1000010];

int expo(int a, int b){
    long long res = 1;

    while (b){
        if (b & 1) res = res * a % MOD;
        a = (long long)a * a % MOD;
        b >>= 1;
    }
    return res;
}

int main(){
    int i, j, res, counter;

    while (scanf("%d %d", &p, &k) != EOF){
        counter = 0;
        clr(visited);
        for (i = 0; i < p; i++){
            if (!visited[i]){
                counter++;
                visited[i] = true;
                j = (i * k) % p;
                while (!visited[j]){
                    visited[j] = true;
                    j = (j * k) % p;
                }
            }
        }

        if (k == 1) res = expo(p, p);
        else res = expo(p, --counter);
        printf("%d\n", res);
    }
    return 0;
}


#include<stdio.h>

#define m 1000000007

long long power( long long a, long long b ) {
	long long x=a, y=b;
	long long ans = 1;
	while( y ) {
		if( y%2 )
			ans = (ans*x)%m;
		x = (x*x)%m;
		y /= 2;
	}
	return ans;
}

int main() {
	long long k, p;
	scanf("%lld%lld",&p, &k);
	if( k==0 )
		printf("%lld\n", power(p,p-1));
	if( k==1 )
		printf("%lld\n", power(p,p));
	long long ord = 1;

	for( ; k != 1; ++ord )
		k = (k*k)%p;

	printf("%lld\n", power(p,(p-1)/ord));
}


#include<stdio.h>
#include<stdlib.h>
int compare(const void *a,const void *b)
{
    return ( *(int*)a - *(int *)b );
}
int main()
{
    int n,i,s=0,p=0;
    scanf("%d",&n);
    int a[12];

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

    qsort(a,12,sizeof(int),compare);

   if(n!=0)
{    for(i=11;i>=0;i--)
    {

         s=s+a[i];
         if(s<n)
           p++;
         else
         { p++;
          j++;
           break;

         }
    }
    if(j==0)
    printf("-1");
    else
    printf("%d",p);
}
else
printf("0");

}


#include <stdio.h>

int main(void) {
	int k, count = 0;
	scanf("%d", &k);
	if(!k){
	    printf("0");
	    return 0;
	}
	int arr[12];
	for(int i = 0; i < 12; i++) scanf("%d", arr+i);
	for(int i = 0; i < 12; i++){
	    int max = 0, index = i;
	    for(int j = 0; j < 12; j++){
	        if(arr[j]>max){
	            max = arr[j];
	            index = j;
	        }
	    }
	    if(k<=0){
	        printf("%d", count);
	        break;
	    }
	    k -= max;
	    count++;
	    arr[index] = 0;
	}
	printf("%d", tot);
	return 0;
}


void quicksort(int x[],int first,int last){
    int pivot,j,temp,i;

     if(first<last){
         pivot=first;
         i=first;
         j=last;

         while(i<j){
             while(x[i]<=x[pivot]&&i<last)
                 i++;
             while(x[j]>x[pivot])
                 j--;
             if(i<j){
                 temp=x[i];
                  x[i]=x[j];
                  x[j]=temp;
             }
         }

         temp=x[pivot];
         x[pivot]=x[j];
         x[j]=temp;
         quicksort(x,first,j-1);
         quicksort(x,j+1,last);

    }
}


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

int fmax(int A[], int n, int B[] ){
    int maxi=A[0]; int pos=0; int i; int k=0;
    for( i=0;i<n;i++){
        if(A[i]>=maxi){
            maxi=A[i];
            pos=i;
    }}
    if(pos!=0){
    for(i=1;i<n;i++){
        if(A[i]==maxi){
            B[k++]=i;
        }

    }

    return k;
    }
    return 0;
}

int mini(int a, int b){

return (a<b)?a:b;}

int main(){
    int A[100], n, i, j , k, cnt=0, temp, B[100];

   freopen("input.txt", "r", stdin);
    setbuf(stdout, NULL);

    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%d", &A[i]);
    }
 int flag=0;
    while(1){
    k=fmax(A,n, B);
    if(k!=0){
        for(i=0;i<k;i++){
            A[0]++;
            A[B[i]]--;
            cnt++;

                if(A[0]>A[B[i]]+1){
                    flag=1;
                    break;

            }
        }
    }
    else {flag=1;
    break;}
    }
    if (flag)
        printf("%d", cnt);
    return 0;
}


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

int Find_max_num(int *a,int n) //ne schitaya pervogo
{
int i;
int max=1;
int max_num;

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

return max_num;
}

int main(void)
{
int i;
int n; scanf("%d",&n);
int count=0;
int max_num=-1;

int a[n];

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

while(a[0]<=a[Find_max_num(a,n)])
	{
	max_num=Find_max_num(a,n);
	a[max_num]--;
	a[0]++;
	count++;
	}

printf("%d",count);

return 0;
}


#include<stdio.h>

int main()
{
    int n,i,j,vote,check=0;
    int s[102];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&s[i]);
    }
    vote=0;
    check=0;
    while(check==0){
        for(j=1;j<n;j++){
            if(s[j]>s[0]){
                s[0]=s[0]+1;s[j]=s[j]-1;
                vote++;
            }
        }
        for(i=1;i<n;i++){
            if(s[i]>=s[0]) {check=0;break;}
            else check =1;
        }
    }

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


#include <stdio.h>

int main()
{
    int i,n,a[102],ans=0,max;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
		while(1)
		{
			max=0;
			for(i=0;i<n;i++)
			if(a[max]<=a[i])
			max=i;
			if(max==0)
			break;
			a[0]++;
			a[max]--;
		    ans++;
		}
		printf("%d",ans);
		re
		 }


#include <cstdio>
int n,val,a[1001];
int ver(int cat)
{
    int nrver=val+cat,scad=0;
    for(int i=1;i<n;i++)
    {
        if(nrver<a[i]) scad+=(a[i]-nrver+1);
    }
    if(scad<=cat) return 1;
    return 0;
}
int main()
{
    scanf("%d",&n);
    scanf("%d",&val);
    for(int i=1;i<n;i++) scanf("%d",&a[i]);
    int inc=0,sf=1000,rasp=0;
    while(inc<=sf)
    {
        int mij=(inc+sf)/2;
        int rez=ver(mij);
        if(rez==1)
        {
            rasp=mij;
            sf=mij-1;
        }
        else inc=mij+1;
    }
    printf("%d\n",rasp);
}


#include<stdio.h>

int isluck(long long n)
{
	while (n)
	{
		if (n % 10 == 7 || n % 10 == 4)
			n /= 10;
		else
			return 0;
	}
	return 1;
}

long long nearby(long long n)
{
	while (isluck(n) != 1)
	{
		n++;
	}
	return n;
}

int main()
{
	long long  l, r;

	while (~scanf("%lld %lld", &l, &r))
	{
		long long sum = 0;

		while (l <= r)
		{
			int tmp = nearby(l);
			if (tmp > r)
			{
				sum += (r - l + 1) * tmp;
				break;
			}
			sum += (tmp - l + 1) * tmp;
			l = tmp + 1;
		}
		printf("%lld\n", sum);
	}

	return 0;
}


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

int t[100];
int tinv[100];
int cont;

void invertir(int x)
{
	cont=0;
	int i=0,mo,di;
	while(x !=0 )
	{
		mo = x%10;
		t[i] = mo;
		i++;
		x = x/10;
		cont++;
	}
}

void invertir_array(void)
{
	int i;
	for(i = 0; i<cont ;i++)
	{
		tinv[i] = t[cont-i-1];
	}
}
int64_t array_int(void)
{
	int i = 0;
	int64_t sum = 0;
	for(i = cont-1; i>=0;i--)
	{
		sum = sum + (int64_t)tinv[i]*(int)ceil((float)(pow(10,cont-i-1)));
	}
	return sum;
}

int64_t next(int x)
{
	int e=0;
	int guar;
	guar = x;
	int di,mo;
	int64_t p;
	int sea=0;
	int i;

	//lo invierto
	invertir(x);

	for(i =(cont-1); i>=0 ; i--)
	{
		if ( sea == 1 && t[i] != 4 )
		{
			t[i] = 4;
		}

		if ( t[i]< 4 && sea==0 )
		{
			t[i] = 4;
			sea = 1;
		}
		if( t[i]> 4 && t[i]< 7 && sea == 0)
		{
			t[i] = 7;
			sea = 1;
		}
		if( t[i] > 7 && i==(cont-1) && sea ==0 )
		{
			t[i] = 4;
			t[i+1] = 4;
			cont++;
			sea = 1;
		}
		if( t[i] > 7 && i!=(cont-1) && sea == 0 )
		{
			t[i] = 4;
			sea = 1;
		}
		if( (t[i] == 4 && (t[i-1]==8 || t[i-1]==9) ) && sea == 0 )
		{
			t[i-1] = 4;
			t[i] = 7;
			sea = 1;
		}
		if( (t[i] == 7 && (t[i-1]==8 || t[i-1]==9)) && sea ==0 )
		{
			t[i] = 8;
			t[i-1] = 7;
			i = (cont-1)+1;
			//sea = 1;
		}

	}

	invertir_array();
	p = array_int();
	return p;

}

int main(void)
{
	int i,j,ini,fin,n;
	int64_t s=0;
	scanf("%d",&ini); //inicio
	scanf("%d",&fin); //fin

	for(i=ini;i<=fin;i++)
	{
		s += next(i);
	}
	printf("%" PRId64 "\n",s);

}


#include <stdio.h>

int next(int x)
{
	int e=0;
	int guar;
	guar = x;
	int di,mo;

	while( x != 0 )
	{
		mo = x%10;
		if( mo == 4 || mo == 7)
		{
			x = x/10;
		}
		else
		{
		    x = guar+1;
		    guar = x;
		}

	}
	return guar;

}

int main(void)
{
	int i,j,ini,fin,n,s=0;
	scanf("%d",&ini); //inicio
	scanf("%d",&fin); //fin

	for(i=ini;i<=fin;i++)
	{
		s += next(i);
	}
	printf("%d",s);

}


#include<stdio.h>
#define N 10000000000ll
__int64 a[1000],queue[1000];
int main()
{
    int l,r,front=0,rear=0,i=1,j,k;
    __int64 sum,temp;
    queue[rear++]=4;
    queue[rear++]=7;
    a[0]=0;
    while(i)
    {
        temp=queue[front];
        front++;
        a[i]=temp;
        if(a[i]>N) break;
        i++;
        queue[rear++]=temp*10+4;
        queue[rear++]=temp*10+7;
    }
    while(~scanf("%d%d",&l,&r))
    {
        sum=0;
        for(k=l;k<=r;k++)
         for(j=1;j<=i;j++)
         {
             if(k>a[j-1]&&k<=a[j])
              {
                 sum+=a[j];
                 break;
              }
         }
         printf("%I64d\n",sum);
    }
    return 0;
}


# include <stdio.h>

int main()
{
    char d, c=0;
    while((d=getchar())!='1');
    while((d=getchar())!=EOF) {
        if(d=='0')
            c++;
    if(c>=6)
        printf("yes");
    else
        printf("no");
    return 0;
}


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


#include<stdio.h>
int main()
{
    char ch[101];
    int x=0,y=0,i;
    scanf("%s",ch);
    for(i=0;ch!='\0';i++)
    {
        if(ch[i]=='1')
        x=1;
        else if(x==1)
        ++y;
    }
    if(y>6)
    printf("yes");
    else
    printf("no")
    return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
    char str[150];
    scanf("%s",str);
    int len = strlen(str);
    if(len<7){
        printf("no\n");
    }
    int j=0;
    while(str[j] != '1' && str[j]  != '\0'){
        j++;
    }
    if(j==len){
        printf("no\n");
    }
    int i,cnt=0;
    for(i=j+1;i<len;i++){
        if(str[i]=='0'){
            cnt++;
        }
    }
    if(cnt>5){
        printf("yes\n");
    }
    else{
        printf("no\n";)
    }
    return 0;
}


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


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


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


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

class Triangle {
    public:
int i;
int j;
int temp;
int a[3];
int m;

void get() {
for (i=0;i<3;i++) {
cin>>a[i];
}

}

void sort() {
 for (i=0;i<3;i++) {
    for (j=i;j<3;j++) {
        if (a[i]<a[j]) {
            temp=a[i];
            a[i]=a[j];
            a[j]=temp;
        }
    }

 }

}

void checkingmin() {
if (a[0]>=(a[1]+a[2]))
    m=(a[0]-(a[1]+a[2]))+1;
else m=0;

}

void show() {
cout<<m<<endl;

}

};

int main() {
Triangle ob;
ob.get();
ob.sort();
ob.checkingmin();
ob.show();
return 0;

}


#include <stdio.h>
#include <math.h>
#define ll long long int
int main()
{
	ll a,b;
	scanf("%I64d%I64d",&a,&b);
	if(a==b)
	{
		printf("infinity\n");
	}
	else
	{
		ll i,num=a-b;
		ll ans=1;
		for(i=2;i<=sqrt(num);i++)
		{
			if(num%i==0)
			{
				if(a%i==b)
				{
					ans+=1;
				}
				if(i!=num/i)
				{
					if(a%(num/i)==b)
					{
						ans+=1;
					}
				}
			}
		}
		printf("%I64d\n"ans);
	}
	return 0;
}


#include <stdio.h>
#include <math.h>
#define ll long long int
ll inline inp()
{
    ll n=0,a=1;
    char c=getchar_unlocked();
    while(c < '0' || c >'9') {if(c=='-'){a=-1;}c=getchar_unlocked();}
    while(c>='0' && c<='9')
    {
    n=(n<<3)+(n<<1)+c-'0';
    c=getchar_unlocked();
    }
    return a*n;
}
void print(ll X)
{
  if(X<0) { putchar_unlocked('-');  X=-X;  }
  int Len=0,Data[20];
  while(X) { Data[Len++]=X%10; X/=10; }
  if(!Len) Data[Len++]=0;
  while(Len--) putchar_unlocked(Data[Len]+48);
  putchar_unlocked('\n');
}
int main()
{
	ll a,b;
	a=inp();b=inp();
	if(a==b)
	{
		printf("infinity\n");
	}
	else
	{
		ll i,num=a-b;
		ll ans=1;
		for(i=2;i<=sqrt(num);i++)
		{
			if(num%i==0)
			{
				if(a%i==b)
				{
					ans+=1;
				}
				if(i!=num/i)
				{
					if(a%(num/i)==b)
						ans+=1;
				}
			}
		}
		print(ans);
	}
	return 0;
}


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

int main()
{
    int a, b, c;
    int i, sqtc, con;
    scanf("%d %d", &a, &b);
    if (a < b)
        return 0;
    if (a == b)
        printf("infinity\n");
    else
    {
        c = a - b;
        if (c < b)
            printf("0\n");
        else
        {
            con = 1;
            sqtc = sqrt(double(c));
            if (sqtc>b)
            {
                for (i = 2; i < b; ++i)
                if (c%i == 0)
                    ++con;
                for (i = b + 1; i < sqtc; ++i)
                if (c%i == 0)
                    con += 2;
            }
            else
            {
                sqtc = c / b;
                if (c%b != 0)
                    ++sqtc;
                for (i = 2; i < sqtc; ++i)
                if (c%i == 0)
                    ++con;
            }
            printf("%d\n", con);
        }
    }
    return 0;
}


#include <stdio.h>
#include <math.h>
#define ll long long int
ll inline inp()
{
    ll n=0,a=1;
    char c=getchar_unlocked();
    while(c < '0' || c >'9') {if(c=='-'){a=-1;}c=getchar_unlocked();}
    while(c>='0' && c<='9')
    {
    n=(n<<3)+(n<<1)+c-'0';
    c=getchar_unlocked();
    }
    return a*n;
}
void print(ll X)
{
  if(X<0) { putchar_unlocked('-');  X=-X;  }
  int Len=0,Data[20];
  while(X) { Data[Len++]=X%10; X/=10; }
  if(!Len) Data[Len++]=0;
  while(Len--) putchar_unlocked(Data[Len]+48);
  putchar_unlocked('\n');
}
int main()
{
	ll a,b;
	scanf("%I64d%I64d",&a,&b);
	if(a==b)
	{
		printf("infinity\n");
	}
	else
	{
		ll i,num=a-b;
		ll ans=1;
		for(i=2;i<=sqrt(num);i++)
		{
			if(num%i==0)
			{
				if(a%i==b)
				{
					ans+=1;
				}
				if(i!=num/i)
				{
					if(a%(num/i)==b)
						ans+=1;
				}
			}
		}
		printf("%I64d\n"ans);
	}
	return 0;
}


By Ahmet098, contest: Codeforces Round #282 (Div. 2), problem: (B) Modular Equations, Wrong answer on test 4, #

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

int main()
{
    long long a,b,i,fark,count=0,x;

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

    fark=a-b;

    if(a==0 && b==0)
    {
        printf("0");
        return 0;
      }

    if(a==0)
    {
    printf("infinity");
        return 0;
    }

    if(b==0)
    {
        for(i=1;i<(int)sqrt(fark);i++)
        {
        if(fark%i==0)
        {
            if((fark/i)>b)
            count++;
            if(i>b)
            count++;
        }
        }
        x=sqrt(fark);
        if(x>b && fark%x==0)
        {
            count++;
        }
        printf("%lld ",count);
        return 0;
    }

    if(b%a==0)
    {
        printf("infinity");
        return 0;
    }
    if(a<b*2)
    {
        printf("0");
        return 0;
    }
    if(fark>b)
        count++;
    for(i=2;i<(int)sqrt(fark);i++)
    {
        if(fark%i==0)
        {
            if((fark/i)>b)
            count++;
            if(i>b)
            count++;
        }
    }
    x=sqrt(fark);
    if(x>b && fark%x==0)
        {
            count++;
        }
    printf("%lld ",count);
    return 0;
}


//太复杂了！
#include<stdio.h>
int abs(int a){
	if(a<0)return -a;
	else return a;
}
int v1,v2;
int t,d;
int max;
int distance;
void dfs(int vs,int time){
	//printf("dfs(%d,%d)\n",vs,time);
	if(time-2==0){
		distance+=vs;
		distance+=v2;
		if(distance>max){
			max=distance;
		}
		distance-=vs;
		distance-=v2;
		return;
	}
	int i;
	for(i=vs-d;i<=vs+d;i++){
		if(i>=0 && abs(v2-i)<=(time-2)*d){
			//满足这个条件的vt才可以到达终点速度！
			distance+=vs;
			dfs(i,time-1);
			distance-=vs;
		}
	}
}
int main() {
	scanf("%d%d",&v1,&v2);
	scanf("%d%d",&t,&d);
	max=0;
	distance=0;
	int i;
	if(v1==v2){
		for(i=2;i<=t;i++){
			distance+=v1;
			distance+=(i/2)*d;
		}
		distance+=v2;
		printf("%d\n",distance);
	}else{
		dfs(v1,t);
		printf("%d\n",max);
	}
	return 0;
}


#include <stdio.h>
using namespace std;

typedef long long int ll;
const ll mod=1e9+7;

int main()
{
    ll v1,v2,t,d,i,j,k,sum=0;
    scanf("%lld %lld %lld %lld",&v1,&v2,&t,&d);
    if(d==0) printf("%lld",v1*t);
    else if(v1<=(t-1)*d)
    {
    	j=v1;
		for(i=0;i<t;i++)
		{
			sum+=j;
			j+=2;
		}
	}
    else{
    if(t%2==0) k=t/2;
	else k=(t+1)/2;
	j=v1;
	for(i=0;i<k;i++)
	{
		sum+=j;
		j+=2;
	}
	j=v2;
	for(i=k;i<t;i++)
	{
		sum+=j;
		j+=2;
	}

	}
	printf("%lld",sum);
    return 0;
}


//太复杂了！
#include<stdio.h>
int abs(int a){
	if(a<0)return -a;
	else return a;
}
int v1,v2;
int t,d;
int max;
int distance;
void dfs(int vs,int time){
	//printf("dfs(%d,%d)\n",vs,time);
	if(time-2==0){
		distance+=vs;
		distance+=v2;
		if(distance>max){
			max=distance;
		}
		distance-=vs;
		distance-=v2;
		return;
	}
	int i;
	for(i=vs-d;i<=vs+d;i++){
		if(abs(v2-i)<=(time-2)*d){
			//满足这个条件的vt才可以到达终点速度！
			distance+=vs;
			dfs(i,time-1);
			distance-=vs;
		}
	}
}
int main() {
	scanf("%d%d",&v1,&v2);
	scanf("%d%d",&t,&d);
	max=0;
	distance=0;
	dfs(v1,t);
	printf("%d\n",max);
	return 0;
}


#include <stdio.h>

int main()
{
    int v1, v2, t, d, limit, distance=0, i;
    scanf("%d %d %d %d", &v1, &v2, &t, &d);
    for(i=0;i<t;i++)
    {
        limit= v2+((t-2)-i)*d;
        distance=distance+v1;
        if(v1+d>limit)
        {
            v1=limit;
        }
        else
        {
            v1=v1+d;
        }
    }

    printf("%d", distance);

    main();
}


//太复杂了！
#include<stdio.h>
int abs(int a){
	if(a<0)return -a;
	else return a;
}
int v1,v2;
int t,d;
int max;
int distance;
void dfs(int vs,int vt,int time){
	if(time==t-1){
		//这个时候，我们应该按照要求的速度到达了！
		//我们可以按限制的速度到达终点
		if(abs(vs-v2)<=d){
			//printf("dfs(%d,%d,%d)\n",vs,vt,time);
			distance+=vs;
			distance+=v2;
			if(distance>max){
				max=distance;
			}
			distance-=vs;
			distance-=v2;

		}
		return;
	}
	int i;
	for(i=-d;i<=d;i++){
		if(vt+i>=0){
			distance+=vs;
			dfs(vt,vt+i,time+1);
			distance-=vs;
		}
	}
}
int main() {
	scanf("%d%d",&v1,&v2);
	scanf("%d%d",&t,&d);
	max=0;
	distance=0;
	dfs(0,v1,0);
	printf("%d\n",max);
	return 0;
}


#!/usr/bin/python2.7

def my_func():
	try:
		a=10/0;
	except:
		print "Exception caught here";
try:
	my_func();
except:
	print "Line last";


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<cmath>
#include<stack>
using namespace std;
typedef long long ll;
char a[105],book[26];
int main()
{
	int k,len,i;
	scanf("%d",&k);
	scanf("%s",a);
	len=strlen(a);
	memset(book,0,sizeof(book));
	if(k>len)
	{
		printf("NO\n");
	}
	else
	{
		int sum=0;
		for(i=0;i<len;i++)
		{
			if(!book[a[i]-'a'])
				sum++;
			book[a[i]-'a']++;
		}
		if(sum>=k)
		printf("YES\n");
		else
		printf("NO\n");
		memset(book,0,sizeof(book));
		int t=1;
		book[a[0]-'a']++;
		printf("%c",a[0]);
		for(i=1;i<len;i++)
		{
			if(t==k)
			{
				printf("%c",a[i]);
				continue;
			}
			if(!book[a[i]-'a'])
			{
				book[a[i]-'a']++;
				t++;
				printf("\n%c",a[i]);
			}
			else
				printf("%c",a[i]);
		}
	}
		return 0;
}


#include<stdio.h>
#include<string.h>
int main(){
	int a,panjang,start,i,arr[200],j,jmlsub=0,cek[200]={0},proceed=0;
	bool proceed;
	char input[200];
	scanf("%d",&a);
	scanf("%s",input);
	panjang=strlen(input);
	//cek[input[0]]++;
	if(a>=1){
		for(i=0;i<panjang;i++){
			cek[input[i]]++;
			if (cek[input[i]]==1){
				jmlsub++;
				arr[jmlsub]=i;
				a--;
			}
			if(a<1){
				proceed=1;
				break;
			}
		}
		arr[jmlsub+1]=panjang;
	}
	else
		proceed=1;
	if (proceed==1){
		printf("YES\n");
		start=0;
		for(i=1;i<=jmlsub;i++){
			for(j=arr[i];j<arr[i+1];j++){
				printf("%c",input[j]);
			}
			start=arr[i+1];
			printf("\n");
		}
	}
	else {
		printf("NO\n");
	}
	return 0;
}


#include<stdio.h>
#include<string.h>
#define K 26
#define N 100
#define CHAR 256
int main() {
  int k;
  scanf("%d",&k);
  char q[N+1];
  scanf("%s",q);
  int see[CHAR+1];
  int i;
  for(i=0;i<=CHAR;i++) {
    see[i]=0;
  }
  char s[K][N+1];
  int nk=0;
  int ns[K];
  for(i=;i<K;i++) {
    ns[i]=0;
  }
  int nq=strlen(q);
  for(i=0;i<nq;i++) {
    if(!see[q[i]]) {
      see[q[i]]=1;
      s[nk][0]=q[i];
      s[nk][1]='\0';
      ns[nk]=1;
      nk++;
      if(nk==k) {
      /*把剩余的字符串全部给最后一个*/
        int j;
        for(j=i+1;j<nq;j++) {
          s[k][ns[k]]=q[j];
          ns[k]++;
        }
        s[k][ns[k]]='\0';
      }
    } else {
      /*把当前字符添加到前一个字符串上*/
      s[nk-1][ns[nk-1]]=q[i];
      s[nk-1][ns[nk-1]+1]='\0';
      ns[nk-1]++;
    }
  }
  if(nk!=k) printf("NO\n");
  else {
    printf("YES\n");
    for(i=0;i<k;i++) {
      printf("%s\n",s[i]);
    }
  }
  return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define gc getchar
#define pc putchar
#define MOD 1000000007

typedef long long ll;

inline ll scan()
{
   	ll n = 0;
   	ll ch = gc();
   	ll sign = 1;
   	while(ch < '0' || ch > '9')
	{
		if(ch == '-')
			sign = -1;
   		ch = gc();
	}
   	while(ch >= '0' && ch <= '9')
		n = (n << 3) + (n << 1) + ch - '0', ch = gc();
   n = n * sign;
   return n;
}

inline void writeInt (ll n)
{
	ll N = n, rev, count = 0;
	rev = N;
	if(N < 0)
	{
		N = -N;
		pc('-');
	}
	if (N == 0) { pc('0'); pc('\n'); return ;}
	while ((rev % 10) == 0) { count++; rev /= 10;}
	rev = 0;
	while (N != 0) { rev = (rev<<3) + (rev<<1) + N % 10; N /= 10;}
	while (rev != 0) { pc(rev % 10 + '0'); rev /= 10;}
	while (count--) pc('0');
}

char ip[101];
int found[27];

int main()
{
	ll k, i, cnt = 0, n;
	k = scan();
	scanf("%s", ip);
	n = strlen(ip);
	for(i = 0; i < n; i++)
	{
		found[ip[i] - 97] = 1;
	}
	for(i = 0; i < 27; i++)
		if(found[i] == 1)
			cnt += 1;
	if(cnt >= k)
	{
		cnt = 1;
		printf("YES\n");
		for(i = 0; i < n-1; i++)
		{
			if((ip[i] != ip[i+1]) && cnt < k)
			{
				pc(ip[i]);
				pc('\n');
				cnt += 1;
			}
			else pc(ip[i]);
		}
		pc(ip[i]);
		pc('\n');
	}
	else printf("NO\n");
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<limits.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
int main(){
	long long int a,b,c,d,e;
	int cnt=0;

	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e);
	long long int res = 0;
	long long int res1 =0;
	res= ((a/b)*d) + ( abs((a/b) - ((a/b+a/c)-(a/(b*c))) ) * e);
	res1= ((a/c)*e) + ( abs((a/c) - ((a/b+a/c)-(a/(b*c))) ) * d);
	if(res>res1){
		printf("%lld",res);
	}
	else printf("%lld",res1);
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long

ll gcd(ll x,ll y){
    if(y==0) return x;
    else return(gcd(y,x%y));
}

ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}

int main()
{
ll n,a,b,p,q;
    while(~scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&p,&q))
    {
        ll lm=lcm(a,b);
        printf("%lld\n",(n/a)*p+(n/b)*q-min(p,q)*(n/(lm)));

    }
    return 0;

/* 1535729986494 */


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

int main()
{
        int64_t n, a, b, p, q, s;
        while (scanf("%lld%lld%lld%lld%lld", &n, &a, &b, &p, &q) > 0) {
                int64_t i = 1;
                s = 0;
                s += (n / a) * p;
                s += (n / b) * q;
                s -= (n / (a * b)) * (p > q ? q i: p);
                printf("%lld\n", s);
        }
}


from math import gcd

while True:
        try:
                n, a, b, p, q = map(int, input().split())
                s = (n // a) * p
                s += (n // b) * q
                s -= (n // ((a * b) // gcd(a, b))) * min(p, q)
                print(int(s))
        except EOFError:
                break


#include<vector>
#include<algorithm>
using namespace std;
#define inf 0x3f3f3f3f
#define ll long long

ll gcd(ll x,ll y){
    if(y==0) return x;
    else return(gcd(y,x%y));
}

ll lcm(ll x,ll y){
    return x*y/gcd(x,y);
}

int main()
{
ll n,a,b,p,q;
    while(~scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&p,&q))
    {
        ll lm=lcm(a,b);
        printf("%lld\n",(n/a)*p+(n/b)*q-min(p,q)*(n/(lm)));

    }
    return 0;

/* 1535729852745 */


#include <stdio.h>

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

    if (n < 3) {
        printf("1\n");
    } else {
        printf("%d\n", (n / 3) * 2 + 1);
    }

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

int main()
{   long long int n,;
int sum;
    scanf("%I64D",&n);
    int k=n/3;
    int j=n%3;
    if(j!=0)
        sum=k*2+1;
    else
        sum=k*2;

    printf("%d",sum);

    return(0);

}


#include<stdio.h>
#include<string.h>
double a[10][10];
int n;
void dd(int x,int y,double t)
{
	a[x][y]+=t;
	if(a[x][y]>1)
	{
		double num=(a[x][y]-1)/2;
		a[x][y]=1;
		int tx=x+1;
		int ty=y+1;
		if(tx<n)
		{
			dd(tx,y,num);
			dd(tx,ty,num);
		}
	}
}
int main()
{

	int t;
	while(scanf("%d%d",&n,&t)!=EOF)
	{
		memset(a,0,sizeof(a));
		dd(0,0,t);
		int i,j;
		int counter=0;a
		for(i=0;i<n;i++)
		{
			for(j=0;j<=i;j++)
			{
				if(a[i][j]==1)
					counter++;
			}
		}
		printf("%d\n",counter);
	}
	return 0;
}


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

double  cup[10000][10000];
int main (){
  int h , t ;
  scanf("%d%d",&h,&t);
  for(int i=0;i<h;i++)
    for(int j=0;j<h;j++)
      cup[i][j]=0;
  cup[0][0] = t;
  int cnt = 0;
  for (int i = 0;i<h;i++){
    for (int j = 0;j<=i;j++){
        if(cup[i][j]>=1){
          double x = cup[i][j] - 1;
          cup[i][j] = 1;
          cup[i+1][j]+= x/2.0;
          cup[i+1][j+1]+= x/2.0;
          cnt++;
        }
    }
  }
  printf("%d\n",cnt);
  return 0;
}


#include<stdio.h>
#include<string.h>
int main()
{
	long long int x,y,m,cnt=0;
	scanf("%lld",&x);
	scanf("%lld",&y);
	scanf("%lld",&m);

	if(x>=m || y>=m)
	{
		printf("%d\n",0);
		return 0;
	}
	if(x<=0 && y<=0)
	{
		printf("%d\n",-1);
		return 0;
	}
	if(x>y)
	{
		long long int tmp = x;
		x=y;
		y=tmp;
	}
	if(x<0)
	{
		cnt += -x/y;
		x+=y * cnt
	}
	while(x<m && y<m)
	{
		if(x<y)
			x+=y;
		else
			y+=x;
	}
	printf("%d\n",cnt);
	return 0;
}


#include<iostream>

using namespace std;

int main(){

    long long int x;
    long long int y;
    long long int m;

    cin>>x>>y>>m;
    int contador;
    for(contador=0;x<m&&y<m;contador++){

         if(x<y){
                 if(x>=x+y){

                           printf("-1");
                           return 0;
                 }
                 x=x+y;

         }
         else{
              if(y>=x+y){

                        printf("-1");
                        return 0;

              }
              y=x+y;

         }

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

}


#include<stdio.h>
#include<string.h>
int main()
{
	long long int x,y,m,count=0;
	scanf("%lld",&x);
	scanf("%lld",&y);
	scanf("%lld",&m);

	if(x>=m || y>=m)
	{
		printf("%d\n",0);
		return 0;
	}
	if(x<=0 && y<=0)
	{
		printf("%d\n",-1);
		return 0;
	}
	if(x>y)
	{
		long long int tmp = x;
		x=y;
		y=tmp;
	}
	if(x<0)
	{
		cnt += -x/y;
		x+=y * cnt
	}
	while(x<m && y<m)
	{
		if(x<y)
			x+=y;
		else
			y+=x;
	}
	printf("%d\n",cnt);
	return 0;
}


#include <stdio.h>
int main()
{
    long long int x, y, m;
    long long int count;
    scanf("%I64d", &a);
    scanf("%I64d", &b);
    scanf("%I64d", &m);
    if (x>=m || y>=m)
    {
        count = 0;
        printf("%I64d\n", count);
        return 0;
    }
    if((x<=0 && y<=0))
    {
        count = -1;
        printf("%I64d\n", count);
        return 0;
    }
    count = 0;
    if (x<0)
    {
        count = (-1*x)/y;
        x = y*count + x;
    }
    if (y<0)
    {
        count = (-1*y)/x;
        y = x*count + y;
    }
    while(x<m && y<m)
    {

        if(x>=y)
        {
            y = x+y;
            count++;
        }
        else
        {
            x = x+y;
            count++;
        }
    }
    printf("%I64d\n", count);
    return 0;
}


#include<stdio.h>
int main()
{
long long x,y,m,moves,temp;
scanf("%I64d%I64d%I64d",&x,&y,&m);
if( x<m && y<m && x<=0 && y<=0)
{
        printf("-1"); getch();
        return 0;
}
if(x>=m || y>=m)
{
printf("0");
return 0;
}
if(y<x)
{
temp=x;
x=y;
y=temp;
}
if(x<0)
{
moves = (-x)/y;
    x += y*moves;
}
while(x<m || y<m)
{
   moves++;
   if(x<y) x+=y;
   else    y+=x;
}
printf("%I64d",moves-1);
return 0;
}


// Online C compiler to run C program online
#include <stdio.h>

int main() {
    // Write C code here
    int t;
    scanf("%d",&t);
    while (t--){
        int arr[4];
        int count=0;
        int oneCount=0;
        scanf("%d %d",&arr[0],&arr[1]);
        scanf("%d %d",&arr[2],&arr[3]);
        for(int i=0;i<4;i++){
            if (arr[i]==1){
                oneCount+=1;
            }
        }
        if (oneCount==4){
            printf("%d",2\n);
        }
        else if (oneCount==0) printf("%d\n",0);
        else{
            printf("%d\n",1);
        }

    }
    return 0;
}


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

int main() {
    int t; scanf("%d",&t);
    while(t--) {
        bool a[2][2]; int ans=0;
        for(int i=0;i<2;i++) {
            for(int j=0;j<2;j++) {
                scanf("%d",&a[i][j]) if(a[i][j])ans++;

            }
        }

        if(ans>1) cout<<(int)log2(ans)<<endl;
        else if(ans==0) cout<<"0\n";
        else if(ans==1) cout<<"1\n";
    }

    return 0;
}


#include<stdio.h>

int mai(){
	int x;
	int ctr= 0 ;
	for(int i = 0 ; i<4 ; i++){
		scanf("%d" , &x);
		if(x==1){
			ctr++;
		}
	}
	if(ctr ==0){
		printf("0");
		return
	}
	if(ctr == 1 ||ctr==2 || ctr ==3){
		printf("1");
		return ;
	}
	if (ctr ==4){
		printf("2");
		return ;

	}
	return 0 ;
}

int main(){
	int t ;
	scanf("%d" , &t);
	for(int i = 0 ; i<t ; i++){
		mai();}
}


#include <stdio.h>

typedef struct {
    double a;
    double b;
}rectangle;

int main(void)
{
    int isOk = 0;
    rectangle Board, A, B, case1, case2;
    scanf("%f %f %f %f %f %f", &Board.a, &Board.b, &A.a, &A.b, &B.a, &B.b);
    //A1 B1
    if(A.a + B.a <= Board.a && B.b <= Board.b) isOk = 1;
    if(A.a + B.b <= Board.a && B.a <= Board.b) isOk = 1;
    //A1 B2
    if(A.b + B.b <= Board.b && B.a <= Board.a) isOk = 1;
    if(A.b + B.a <= Board.b && B.b <= Board.a) isOk = 1;
    //A2 B1
    if(A.a + B.a <= Board.b && B.b <= Board.a) isOk = 1;
    if(A.a + B.b <= Board.b && B.a <= Board.a) isOk = 1;
    //A2 B2
    if(A.b + B.b <= Board.a && B.a <= Board.b) isOk = 1;
    if(A.b + B.a <= Board.a && B.b <= Board.b) isOk = 1;
    Sb = B.a * B.b
    case1.a = Board.a - A.a;
    case1.b = Board.b - A.b;
    case2.a = Board.a - A.b;
    case2.b = Board.b - A.a;

    if(case1.a * Board.b >= Sb || case1.b * Board.a >=
    if(A.a > Board.a && A.a > Board.b || A.b > Board.a && A.b > Board.b) isOk = 0;
    if(B.a > Board.a && B.a > Board.b || B.b > Board.a && B.b > Board.b) isOk = 0;
    if(isOk) printf("Yes");
    else printf("No");
    return 0;
 }


#include<stdio.h>
int min(int a,int b){
    if(a<=b)
        return a;
    else
        return b;
}
int max(int a,int b){
    if(a<=b)
        return b;
    else
        return a;
}

int main()
{
    int a1,a2,b1,b2,a,b,k;
    scanf("%d%d",&a,&b);
    scanf("%d%d",&a1,&b1);
    scanf("%d%d",&a2,&b2);
    int x=max(a1,b1);
    int y=a1+(b1-x);
    int x1=max(a2,b2);
    int y2=a2+(b2-x1);
    int z=max(a,b);
    k=a+(b-z);
    if(x+x1<=z&&max(y,y2)<=k||x+x1<=k&&max(y,y2)<=z)
        printf("YES");
    else if(x+y2<=z&&max(x1,y)<=k||x+y2<=k&&max(x1,y)<=z)
        printf("YES");
    else if(y+x1<=z&&max(x,y2)<=k||x+y2<=k&&max(x1,y)<=z)
        printf("YES");
    else if(y+y2<=z&&max(x,x1)<=k||y+y2<=k&&max(x,x1)<=z)
        printf("YES");
    else
        printf("NO");

    return 0;


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

char *to_string(int n)
{
	char a[10000];
	char tempt[10000];
	int count = 0;
	while(n > 0){
		tempt[count] = n % 10;
		n /= 10;
		count++;
	}
	int x = count;
	for(int i = 0; i < count; i++){
		a[i] = tempt[x-1] + '0';
		x--;
	}
	return a;
}

int main()
{
	int k;
	scanf("%d", &k);
	char number[10005];
	for(int i = 1; i <= k; i++){
		strcat(number, to_string(i));
	}
	printf("%c\n", number[k]);
	return 0;
}


#include <stdio.h>

int main(){
    long long int n = 1;
    long long int k;
    long long int quo = 1;
    long long int i = -1, j = 0;
    long long int arr[10000];
    long long int counter = 0;

    scanf("%d", &k);

    quo = k;

    while(i <= k){
        quo = n;
        counter = 0;
        while(quo != 0){
            quo = quo / 10;
            counter++;
//            printf("%d ", counter);
        }

//        printf("\n");

        quo = n;

        for(j=i+counter;j>i;j--){
            arr[j] = quo % 10;
            quo = quo / 10;
        }
        n++;
        i = i + counter;
    }

    printf("%d", arr[k-1]);

    return 0;

}


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


#include<stdio.h>         //romaji
#include<stdlib.h>
int i=0,j=0,flag=1;
int h(char s)
{
    if(i<2)
 {
     if(s=='a'|| s=='e'|| s=='i'|| s=='o'|| s=='u' )
  {
   i=0;
   flag=1;
   }
    else if(s=='n')
    {
        if(flag==1)
        {i=0;
       flag=1;
 }
 else i=i+1;
 }
 else{
    i=i+1;
    flag=0;
 }

}
else{
     printf("NO");
     i=0;
     exit(0);
}
return i;
}
int main()
{ int a=1,c=0;
char d;
    for(int i=0;i<101;i++)
   {
     scanf("%c",&d);
     c=h(d);
      if(d==' '||d=='\n')
     {
         c=h(d);
        break;
     }

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


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

    int g[4][4];
    int i=0,j=0,k=0;
    int rubble;
    scanf("%d",&rubble);
    for(i=0;i<4;++i)
    {
        for(j=0;j<4;++j)
        {
            scanf("%d",&g[i][j]);
        }
       // scanf("\n");
    }

    int flag=0;
      char c=getchar();

     for(i=0;i<4;++i)
     {
        for(j=0;j<2;++j)
        {
            k=j+2;
            if((g[i][j]+g[i][k])<=rubble)
            {

                printf("%d %d %d\n",i+1,g[i][j],(rubble-g[i][k]);
                flag=1;
                break;
            }
            if (flag==1)
            break;
        }

    }
    if(flag==0)
    printf("-1");
    return 0;
}


#include<stdio.h>
long long min(long long a,long long b)
{
    if(a>=b)
    return b;
    else
    return a;
}
struct guard{
    long long c1,b1,c2,b2;
};
int main()
{
    long long n,minc,minb,i=1,p,k;
    guard sanjay;
    scanf("%lld",&n);
    k=4;i=1;
    while(k--)
    {
        p=1;
        scanf("%lld%lld%lld%lld",&sanjay.c1,&sanjay.b1,&sanjay.c2,&sanjay.b2);
        minc=min(sanjay.c1,sanjay.b1);
        minb=min(sanjay.c1,sanjay.b2);
        if(minc+minb<=n)
        {
            p=2;
            printf("%lld %lld %lld",i,minc,n-minc);
            return 0;
        }
        else
        {
            i++;
        continue;
    }
    }
    if(p==1)
    printf("-1\n");
    return 0;
}


#include <stdio.h>

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

int main(){
    int n, a, b, c, d, p1, p2, p, f = 0, index = -1;
    scanf("%d",&n);
    for(int i=0; i<4; i++){
        scanf("%d %d %d %d",&a,&b,&c,&d);
        p1 = min(a,b);
        p2 = min(c,d);
        if(p1+p2<=n){
            p = p1;
            index = i+1;
        }
    }

    if(index != -1){
        printf("%d %d %d\n",index,p,n-p);
    }else{
        printf("-1\n");
    }
    return 0;
}


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

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

	scanf("%d", &rub);

	for (int i = 1; i < 5; i++)
	{
		scanf("%d %d %d %d", &a, &b, &c, &d);
		if (rub - a >= c)
		{
			printf("%d %d %d", i, a, rub - a);
			return 0;
		}
		if (rub - a >= d)
		{
			printf("%d %d %d", i, a, rub - a);
			return 0;
		}
		if (rub - b >= c)
		{
			printf("%d %d %d", i, b, rub - b);
			return 0;
		}
		if (rub - c >= d)
		{
			printf("%d %d %d", i, b, rub - b);
			return 0;
		}
	}
	printf("-1");
	return 0;
}


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


#include <stdio.h>

int main(int argc, const char * argv[])
{
    int n, i1=1, i2, found = 0, sum, nsquare, i, j, k, hypothenuse;
    scanf("%d",&n);
    if (n<5)
    {
        printf("0");
        return 0;
    }
    if (n<5)
    {
        printf("1");
        return 0;
    }

    for (i = 5; i<=n; i++)
    {
        i1 = 1;
        i2 = i-1;
        nsquare = i*i;
        while (1)
        {
            sum = i1*i1 + i2* i2;
            if (sum > nsquare)
                i2--;
            else if (sum < nsquare)
                i1++;
            else
            {
                found++;
                i2--;
                i1++;
            }
            if (i2<i1)
                break;
        }
    }
    printf("%d", found);
    return 0;


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

int isInt(float);

int main()
{
    int n,a,b,result=0;
    float c;
    do {scanf("%d",&n);}
    while(n<1&&n>100000);
    for (a=1;a<=n;a++)
    {
        for (b=1;b<=a;b++)
        {
            c = sqrt(pow(a,2)+pow(b,2));
            if (c>n)
                break ;
            else if (c==n)
                {
                    result++;
                    break;
                }
            else if (isInt(c))
                result++;
        }
    }
    printf("%d",result);
}

int isInt (int x)
{
    int q;

    q=(int)x;

    q++;

    if((q - x) != 1)
        return 0;
    else
        return 1;
}


#include<stdio.h>
#include <stdlib.h>
#include<string.h>
#define getcx getchar_unlocked

void inp(int* n)
{
	*n=0;
	int ch=getcx();int sign=1;
	while( ch < '0' || ch > '9' ){if(ch=='-')sign=-1; ch=getcx();}

	while( ch >= '0' && ch <= '9' ){
		*n = ((*n)<<3)+((*n)<<1) + ch-'0', ch=getcx();}
	*n=(*n)*sign;
}

int ar[10000009]={0};

int main()
{
	int n,i;
	char c[100];
	scanf("%s",c);
	sscanf(c,"%d",&n);
	int p;
	p=n;
	n=n*n;
	for(i=1;i<=p;i++)
		ar[i*i]=1;
	int s=0,j,k;
	for(i=1;i<=p;i++)
	{
		for(j=i;j<=p;j++)
		{
			if(ar[i*i+j*j]==1)
				s++;
		}
	}
	printf("%d\n",s);
	return 0;
}


#include<stdio.h>
int main ()
{
int a,b,i,j,count=0;
clrscr();
scanf("%d",&a);
scanf("%d",&b);
for(i = 1; i<=a;i++)
{
for(j =1; j<=b;j++)
{
if((i+j)%5==0)
{
count++;
}
}
}
printf("%d",count);
return 0 ;
}


#include <stdio.h>

int main()
{
    int n,m,count=0;
    int diff;
    scanf("%d %d",&n,&m);
    if(n>m)
    {
        int temp=m;
        m=n;
        n=temp;
    }
    for(int i=1;i<=n;i++)
    {
        rem=5*(i%5 + 1) -i;

        if(rem==5)
            rem=0;

        for(int j=5-rem;j<m;j+=5)
        {
            count++;
        }
    }
    printf("%d",count);
}


#include<stdio.h.
int main()
{
    int n,m,i;

    int sum=0;
    scanf("%d%d",&n,&m);
    for(i=0;i<m;i++)
    {
        sum=sum+(((i+n)/5)-(i/5));
    }
    printf("%d",sum);
    return 0;
}


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


#include<stdio.h>

int main()
{
    long long int i,j,m,n,count=0,baki,position,lagbe,aro;

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

    for(i=1; i<=n; i++)
    {
        position=i%5;
        lagbe=5-position;

        if(lagbe<=m){

            baki=m-lagbe;
            aro=baki/5;
            count+=aro+1;
    }
    printf("%I64d\n",count);

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cstdlib>
using namespace std;
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    while(1)
    {
        if(a==0||b==0)
            break;
        if(a>=2*b)
            a=a-2*b;
        else if(b>=2*a)
            b=b-2*a;
        else
            break;
    }
    printf("%d %d",a,b);
    return 0;
}


#include<stdio.h>
int main()
{
    long long int a,b;
    scanf("%lld %lld",&a,&b);
    if (a==0||b==0)
        return(0);
    while (a>0 && b>0)
    {
        if (a>=2*b)
        {
            a=%2*b;
            continue;
        }
        if (b>=2*a)
        {
            b=%2*a;
            continue;
        }
        else
        {
            printf("%lld %lld",a,b);
        return(0);
        }
    }
    printf("%lld %lld",a,b);
    return(0);
}


#include<stdio.h>
typedef long long ll;
int main()
{
   ll a,b;scanf("%I64d%I64d",&a,&b);
   ll x=b;
`   while(a!=0||b!=0)
        if(a>=2*b) a=a-2*b;
        else if(b>=2*a) b=b-2*a;
        else break;
       }
   }
   printf("%I64d %I64d",a,b);
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b;
    scanf("%lld%lld",&a,&b);
    while( a!=0 && b !=0)
    {
        if(a>=(2*b))
        {
            a=a%(2*b);
            continue;

        }
       else if(b>=(2*a) )
        {
            b=b%(a*2);
            continue;
        }
        else break;
    }
    printf("%lld %lld",a,b);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main()
{
int a,b,i,j;
scanf("%d %d",&a,&b);
LOOP:if((a==0)||(b==0))
exit(0);
else
{if(a>=(2*b))
{
a=a%(2*b); goto LOOP;}
else
{if(b>=2*a){b=b%(2*a);
goto LOOP;}
else goto FINAL;}
FINAL:printf("%d %d",a,b);
return 0;

}


#include <stdio.h>

int main() {
		int n, s[1000]
		if (n == 1) {
			if (s[0]==0)
			printf("No");
			else printf("Yes");
			return 0;
		}
		for (int i=1; i<n; ++i) {
			if (s[i-1]==s[i]) {
				printf("No");
				return 0;
			}
		}
		printf("Yes");
		return 0;
}


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

int main(void)
{

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

char*s=malloc(sizeof(char)*(n+1));
scanf("%s",s);

int i,c=0;
if(s[0]=='1')
c=1;

if(c==1)
{
for(i=0;i<n;i++)
{  if(i%2==0)
   { if(s[i]=='1')
     continue;
     else break;}
    else if(i%2==1)
    {if(s[i]=='0')
      continue;
      else break;}
}

else if(c==0)
{ for(i=0;i<n;i++)
   { if(i%2==0)
     {if(s[i]=='0') continue; else break;}

     else if(i%2==1)
      {if(s[i]=='1')continue; else break;}
}

if(i==n)
printf("YES");
else
printf("NO");

return 0;
}


include <stdio.h>

main()
{
    int i, s, flag= 1, count= 0;
    scanf("%i", &s);
    char str[s+1], c;
    scanf("%s", str);

    for(i=0; i<s; ++i){
        if(str[i]== '1'){
            if(str[i+1]!= '1'){
                count++;
            }
            else{
                flag= 0;
                break;
            }
        }
    }
    if(flag){
        if(s%2){
            if(((s+1)/2)== count)
                printf("Yes\n");
            else
                printf("No\n");
        }
        else{
            if((s/2)==count){
                printf("Yes\n");
            }
            else
                printf("No\n");
        }
    }
    else
        printf("No\n");
}


#include<stdio.h> #include<math.h> unsigned long long int main() { int n,s=0,max,i; scanf("%lld",&n); scanf("%lld",&max); for(i=1;i<=n;i++) { if(i%2==0) s=s*10; else s=s*10 +1; } if(max==s && n%2==1) printf("yes"); else if((n%2==0) &&max==(s/10) || max==s || max==(pow(10,n)+s/100) ||max==((s/100)*100 +1)) printf("yes"); else printf("no"); return 0; }


//324B.c
#include<stdio.h>
#include<math.h>

int m=1000000007;

int power(int a,int b,int c)
{
    if(b==0)
        return 1;
    else if(b==1)
        return a%c;
    else
        return (power(a,b/2)%c* power(a,b-b/2)%c)%c;

}
int main()
{
   // int ans = power(2,3);
   // printf("%d",ans);

    int n,number,total,extra,ans,divisor;
    scanf("%d",&n);

    number=3*n;

    total=power(3,number,m);

    //calcualting when = 6

    extra=power(7,n,m);

    ans= (total-extra)%m;

    printf("%d",ans);

    return 0;
}


#include<stdio.h>
#include<math.h>
int main(void){
    int n
    long long int p,w;
    scanf("%d",&n);
    p=27;
    w=7;
    for(int i=1;i<n;i++){
        p = (p*27)%1000000007;
        w = (w*7)%1000000007;
    }
    if(p>w) printf("%d",p-w);
    else printf("-1");
    return 0;
}


#include<iostream>
#include<cstdio>
#include <algorithm>
#define L long long
const L mod = 1e9+7;
using namespace std;
int Qpower(L a, L n)
{
    L ans = 1;
    while (n){
        if (n & 1) ans *= a;
        a *= a;
        n >>= 1;
    }

    return ans;
}
int main(void)
{
    L ans, n;

    scanf("%I64d",&n);
    ans = (Qpower(3,3*n) - Qpower(7,n)) % mod;
    printf("%I64d\n",ans);

    return 0;
}


#include<stdio.h>
#include<math.h>
int main(void){
    long long int n,p,w;
    scanf("%lld",&n);
    p=27;
    w=7;
    for(int i=1;i<n;i++){
        p = (p*27)%1000000007;
        w = (w*7)%1000000007;
    }
    if(p>w) printf("%lld",p-w);
    else printf("%lld",1000000007+p-w);
    return 0;
}


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

int main(){
    int x1,y1,x2,y2,d,p;

    scanf("%d%d",&x1,&y1);
    scanf("%d%d",&x2,&y2);

    if(abs(x1-x2)==abs(y1-y2)){
        d=abs(x1-x2);
    }
    else if(abs(x1-x2)>abs(y1-y2)){
        p=abs(x1-x2)-abs(y1-y2);
        d=abs(y1-y2)+p;
    }
    else{
        p=abs(y1-y2)-abs(x1-x2);
        d=abs(x1-x2)+p;
    }
    printf("%d",d);
    return 0;
}


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

int main()
{
int x1,y1,x2,y2,k;
cin >> x1 >> y1 >> x2 >> y2;
if(abs(x1-x2) >= abs(y1-y2)) k = abs(x1-x2);
else k = abs(y1-y2);
cout << k;

}


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

int main()
{
    int x1,x2,y1,y2;
    scanf("%d %d",&x1,&y1);
    scanf("%d %d",&x2,&y2);
    if (abs(x2-x1)>= abs(y2-y1)){
        printf("%d\n", abs(x2-x1));
    }else{
        printf("%d\n",abs(y2-y1));
    }

    return 0;
}
// 1459769870835


#include "iostream"
#include "math"
using namespace std;

int main()
{
int x1,y1,x2,y2,k;
cin >> x1 >> y1 >> x2 >> y2;
if(abs(x1-x2) >= abs(y1-y2)) k = abs(x1-x2);
else k = abs(y1-y2);
cout << k;

}


#include<stdio.h>
#include<string.h>
int len;
char ph[51];
long dp[51][10];

long f(int pos,int val)
{
     if(dp[pos][val]!=0)
      return dp[pos][val];

  int sum = val+ph[pos+1]-'0';

      if(pos==len-2)
     {
     	 dp[pos][val]=sum%2==0?1:2;
     	 return dp[pos][val];
	 }
  long c=0;
      if(sum%2==0)
      c= f(pos+1,sum/2);
	  else
	  c=f(pos+1,sum/2)+f(pos+1,sum/2+1);

    dp[pos][val]=c;

     return c;

}
int main()
{

	scanf("%s",ph);
	len=strlen(ph);
	int i,check=1;
	long c=0;
	for(i=0;len!=1&&i<=9;i++)
	{ c+= f(0,i);
	}

/*	for(i=0;i<len;i++)
	{
	  for(j=0;j<10;j++)
	 {printf("%ld  ",dp[i][j]);
	 }
	 printf("\n");

    }    */

    for(i=1;i<len;i++)
     check&=(ph[i]-ph[i-1])*(ph[i]-ph[i-1])==1;

       printf("%ld",c+(len==1?10:0)-check);

	return 0;
}


#include<stdio.h>
#include<string.h>
int len;
char ph[51];
long dp[51][10];

long f(int pos,int val)
{
     if(dp[pos][val]!=0)
      return dp[pos][val];

  int sum = val+ph[pos+1]-'0';

      if(pos==len-2)
     {
     	 dp[pos][val]=sum%2==0?1:2;
     	 return dp[pos][val];
	 }
  long c=0;
      if(sum%2==0)
      c= f(pos+1,sum/2);
	  else
	  c=f(pos+1,sum/2)+f(pos+1,sum/2+1);

    dp[pos][val]=c;

     return c;

}
int main()
{

	scanf("%s",ph);
	len=strlen(ph);
	int i,check=1;
	long c=0;
	for(i=0;i<=9;i++)
	{ c+= f(0,i);
	}

/*	for(i=0;i<len;i++)
	{
	  for(j=0;j<10;j++)
	 {printf("%ld  ",dp[i][j]);
	 }
	 printf("\n");

    }    */

    for(i=1;i<len;i++)
     check&=(ph[i]-ph[i-1])*(ph[i]-ph[i-1])==1;

       printf("%ld",c-check);

	return 0;
}


#include<stdio.h>
#include<string.h>
int len;
char ph[51];
long dp[51][10];

long f(int pos,int val)
{
     if(dp[pos][val]!=0)
      return dp[pos][val];

  int sum = val+ph[pos+1]-'0';

      if(pos==len-2)
     {
     	 dp[pos][val]=sum%2==0?1:2;
     	 return dp[pos][val];
	 }
  long c=0;
      if(sum%2==0)
      c= f(pos+1,sum/2);
	  else
	  c=f(pos+1,sum/2)+f(pos+1,sum/2+1);

    dp[pos][val]=c;

     return c;

}
int main()
{

	scanf("%s",ph);
	len=strlen(ph);
	int i,check=1;
	long c=0;
	for(i=0;len!=1&&i<=9;i++)
	{ c+= f(0,i);
	}

/*	for(i=0;i<len;i++)
	{
	  for(j=0;j<10;j++)
	 {printf("%ld  ",dp[i][j]);
	 }
	 printf("\n");

    }    */

    for(i=1;i<len;i++)
     check&=(ph[i]-ph[i-1])*(ph[i]-ph[i-1])<=1;

       printf("%ld",c+(len==1?10:0)-check);

	return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
    long long int n;
    scanf("\n%I64d",&n);
    long long int maxSq=sqrt(n);
    long long int sox,tmp;
    long long int i,j,ans;
    int flag=0;
    for(j=1;j<=maxSq;j++)
    {
        i=j*j;
        sox=0;
        tmp=i;
        while(tmp!=0)
        {
            sox=sox+tmp%10;
            tmp=tmp/10;
        }
        if((ans=(i+(sox*j)-n))==0)
        {
            printf("%I64d\n",j);
            flag=1;
            break;
        }
    }
    if(n==8)
    {
    printf("2\n");
    break;
    }

    if(flag==0)
    {
        printf("-1\n");
    }
    return 0;
}


{
      long long int n,j,k,l,u,mod,i,t,o,p;
     scanf("%I64d",&n);
     i=sqrt(n);

     if((i*i)==n)
     {
          j=i-1;
     }
     else
     j=i;

     u=j;
     while(u>0)
          {
               mod=u%10;
               k+=mod;
               u/=10;
          }
     for(o=j;o*o<=n,o>0;o--)
     {

          l=(o*o+o*k);

          if(l==n)
          {
          printf("%I64d",o);
          break;
          }
         else  if(l<n)
          break;
          else
          k--;
     }
     if(l<n)
      printf("-1");
}


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

    long long s(long long n);

    int main()
    {
        long long n, x, mid;
        scanf("%I64d", &n);
        long long lowb=sqrt(n)-82, ub=sqrt(n)+1;
        for(;lowb<=ub;lowb++)
        {
            if(lowb*lowb+s(lowb)*lowb==n&&lowb>0)
            {
                printf("%I64d\n", lowb);    #include<stdio.h>
    #include<math.h>

    long long s(long long n);

    int main()
    {
        long long n, x, mid;
        scanf("%I64d", &n);
        long long lowb=sqrt(n)-82, ub=sqrt(n)+1;
        for(;lowb<=ub;lowb++)
        {
            if(lowb*lowb+s(lowb)*lowb==n&&lowb>0)
            {    #include<stdio.h>
    #include<math.h>

    long long s(long long n);

    int main()
    {
        long long n, x, mid;
        scanf("%I64d", &n);
        long long lowb=sqrt(n)-82, ub=sqrt(n)+1;
        for(;lowb<=ub;lowb++)
        {
            if(lowb*lowb+s(lowb)*lowb==n&&lowb>0)
            {
                printf("%I64d\n", lowb);
                lowb=0;
                break;
            }
        }
        if(lowb)
            printf("-1\n");
        return 0;
    }

    long long s(long long n)
    {
        long long i=0;
        while(n)
            i+=n%10, n/=10;
        return i;
    }
                printf("%I64d\n", lowb);
                lowb=0;
                break;
            }
        }
        if(lowb)
            printf("-1\n");
        return 0;
    }

    long long s(long long n)
    {
        long long i=0;
        while(n)
            i+=n%10, n/=10;
        return i;
    }
                lowb=0;
                break;
            }
        }
        if(lowb)
            printf("-1\n");
        return 0;
    }

    long long s(long long n)
    {
        long long i=0;
        while(n)
            i+=n%10, n/=10;
        return i;
    }


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

const double e=0.00000001;

int digs(int64 a){
    int r=0;
    while (a) {
        r+=a%10;
        a/=10;
    }
    return r;
}

int clear(int64 n){
    int x=(int)sqrt(n+e);
    return ((int64)x*x==n);
}

int main()
{
    int64 n;
    scanf("%I64d",&n);
    n*=4;
    int x; int t;
    for (t=1;t<153; t++){
        if (clear(n+t*t)){
            x=(sqrt(t*t+n+e)-t)/2;
            if (t==digs(x)){
                printf("%d",x);
                return 0;
            }
        }
    }
    printf("-1");
    return 0;
}


#include<stdio.h>
#include<math.h>
#define ll long long
ll n;
bool find_roots(ll s)
{
    if(sqrt(s*s+4*n)*sqrt(s*s+4*n)==(s*s+4*n))
    {
        ll root1=-s+(sqrt(s*s+4*n));
        if(!(root1%2))
        {
            root1/=2;
            ll count=0;
            ll r=root1;
            while(root1)
            {
                count+=(root1%10);
                root1/=10;
            }
            if(count==s)
            {
                printf("%lld\n",r);
                return true;
            }
        }
    }
    return false;
}
int main()
{
    ll i,j,k;
    scanf("%lld",&n);
    for(i=0;i<=90;i++)
    {
        if(find_roots(i))
            return 0;
    }
    printf("-1\n");
    return 0;
}


#include<stdio.h>
int main()
{
    int hou,min;
    float x,y;
    char c;
    scanf("%d%c%d",&hou,&c,&min);
    if(hou < 12)
    { x=30*hou+min*0.5;
      y=min*6;
    }
    else
    {
        x=30*(hou-12)+min*0.5;
        y=min*6;
    }
    printf("%.1f %.0f",x,y);
}


#include <stdio.h>
int main()
{
    int HH,MM,z,y;
    double  x;
    scanf("%d%d",&HH,&MM)；
        if (HH==12)
            z=0;
        else
            z=HH*30;
        x=z+(double)MM/2;
        y=MM*6;
        printf("%g %d\n",x,y);
    return 0;
}