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

int main()
{
    long long a,b;
    scanf("%I64d %I64d",&a,&b);
    if(a>[b){
        printf("%I64d\n",b/2);
        return 0;
    }
    else if((2*a-1)>=b){
            if((2*a-1)=>=b)
                printf("1\n");
            else printf("%I64d",((b/2)-(b-1-a)));
        }
    else printf("0\n");
    return 0;
}


#include<stdio.h>
#include<math.h>
long long int isPrime(long long int n)
{
    // Corner case
    if(n==2 || n==1)
        return 1;
    if(n%2==0)
        return 0;
    if (n <= 1)
        return 0;

    // Check from 2 to n-1
    for (long long int i = 2; i <= sqrt(n) + 1; i++)
        if (n % i == 0)
            return 0;

    return 1;
}
int main()
{
    long long int q, i, m;
    scanf("%lld",&q);
    if(isPrime(q))
    {
        printf("1\n0");
        return 0;
    }
    for(i=2;i<q;i++)
    {
        if(q%i==0 && isPrime(i))
        {
            break;
        }
    }
    m = i;
    for(i=m;i<q;i++)
    {
        if(!isPrime(i) && q%i==0)
        {
            printf("1\n%lld",i);
            return 0;
        }
    }
    printf("2");
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
long long arr[40000005];
char str[2000001];
char s1[2000001];
int func(const void *a, const void *b)
{
	return (*(int*)a-*(int*)b);
}
long long max(long long a, long long b)
{
	return (a>b)?a:b;
}
long long min(long long a, long long b)
{
	return (a>b)?b:a;
}
long long power(long long  x, long long  int y, long long p)
{
	long long int res = 1;
	x = x % p;
	while (y > 0)
	{
		if (y & 1)
			res = (res*x) % p;
		y = y>>1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
long long isPrime(long long int n)
{
	if (n <= 1)  return 0;
	if (n <= 3)  return 1;
	if (n%2 == 0 || n%3 == 0) return 0;

	for (long long int i=5; i*i<=n; i=i+6)
		if (n%i == 0 || n%(i+2) == 0)
			return 0;
	return 1;
}
int main()
{
	long long int sum=0,a,b,x,y,n, m,temp,flag=0,index,len, i, j, k, count=0, ans=0;
	scanf("%lld", &n);
	if(n==1 || isPrime(n)==1)
	{
		printf("1\n");
		printf("0\n");
	}
	else
	{
		for(i=0;i<=40000005;i++)
			arr[i]=i;
		for(i=2;i*i<=40000005;i++)
			if(arr[i]!=0)
				for(j=0;j*i+i*i<=40000005;j++)
					arr[i*i+j*i]=0;
		for(i=2;i<=40000005;i++)
			if(n%i==0 && arr[i]==0 && i!=n)
			{flag=1;break;}

		if(flag)
		{printf("1\n");printf("%lld\n",i);}
		else
			printf("2\n");
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int arr[20000005];
char str[2000001];
char s1[2000001];
int func(const void *a, const void *b)
{
	return (*(int*)a-*(int*)b);
}
long long max(long long a, long long b)
{
	return (a>b)?a:b;
}
long long min(long long a, long long b)
{
	return (a>b)?b:a;
}
long long power(long long  x, long long  int y, long long p)
{
	long long int res = 1;
	x = x % p;
	while (y > 0)
	{
		if (y & 1)
			res = (res*x) % p;
		y = y>>1; // y = y/2
		x = (x*x) % p;
	}
	return res;
}
long long isPrime(long long int n)
{
	if (n <= 1)  return 0;
	if (n <= 3)  return 1;
	if (n%2 == 0 || n%3 == 0) return 0;

	for (long long int i=5; i*i<=n; i=i+6)
		if (n%i == 0 || n%(i+2) == 0)
			return 0;
	return 1;
}
int main()
{
	long long int num1, num2,sum=0,a,b,x,y,n, m,temp,flag=0,index,len, i, j, k, count=0, ans=0;
	scanf("%lld", &n);
	if(n==1 || isPrime(n)==1)
	{
		printf("1\n");
		printf("0\n");
	}
	else
	{
		for(i=0;i<20000005;i++)
			arr[i]=i;
		arr[1]=0;
		for(i=2;i*i<20000005;i++)
			if(arr[i]!=0)
				for(j=0;j*i+i*i<20000005;j++)
					arr[i*i+j*i]=0;

		for(i=2;i<20000005;i++)
			if(arr[i]!=0 && n%i==0)
			{num1=i;break;}
		for(i=2;i<20000005;i++)
			if(arr[i]!=0 && n%i==0)
			{
				if(i==num1 && n%(i*i)==0)
				{num2=i;break;}
				if(i!=num1)
				{num2=i;break;}
			}
		for(i=2;i<20000005;i++)
			if(arr[i]!=0 && n%i==0)
			{
				if(num1==num2 && n%(i*i*i)==0)
				{flag=1;break;}
				if(i!=num1 && i!=num2)
				{flag=1;break;}
				if(i==num1 || i==num2)
				{
					if(n%(num1*num1*num2)==0 || n%(num2*num2*num1)==0)
					{flag=1;break;}
				}
			}
	//	printf("%lld %lld\n",num1, num2);
		if(flag)
		{
			printf("1\n");
			printf("%lld\n",num1*num2);
		}
		else
			printf("2\n");
		/*
		for(i=2;i<=20000005;i++)
			if(n%i==0 && arr[i]==0 && i!=n)
			{flag=1;break;}
		if(flag)
		{printf("1\n");printf("%lld\n",i);}
		else
			printf("2\n");
			*/
	}
	return 0;
}


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

int main()
{
    long long int q,i,num,cnt,c,arr[10000000000000] ;

    scanf("%I64d",&q) ;

    if(q==1){
        printf("1\n0\n") ;
    }

    else{

    num=sqrt(q) ;

    c=0;
    cnt=0;
    while(q%2==0){
        cnt++;
        q=q/2 ;
        arr[c]=2;
        c++;
    }
    for(i=3;i<=num;i=i+2){
        while(q%i==0){
            cnt++;
            q=q/i ;
            arr[c]=i ;
            c++;
        }
    }
    if(q>2){
        cnt++;
        arr[c]=q ;
        c++;
    }

    if(cnt==2){
        printf("2\n") ;
    }
    else if(cnt==1){
        printf("1\n0\n") ;
    }
    else{
        printf("1\n") ;
        printf("%I64d\n",(arr[0]*arr[1])) ;
    }
    }

    return 0 ;

}


#include<stdio.h>

int main()

{
	int n,i,j,k=0,m;
    scanf("%d",&n);
	char col[n];
	scanf("%s",col);
	loop:
	i=0;
		if(col[i]=='B'){
			col[i]='R';
			k++;
			goto loop;
		}
		else if(col[i]=='R'){
			for(j=i;j<n;j++){
				if(col[j]=='B'){
					col[j]='R';
				for(m=i;m<j;m++){
						col[m]='B';
					}
					k++;
					goto loop;
				}
			}
		printf("%d",k);
	}
}


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

int isSolution(char *,int);
void swap(char *x,char *y)
{
    char t=*x;
    *x=*y;
    *y=t;

}

int main()
{
    int n;
    scanf("%d",&n);
    char S[50];
    scanf("%s",S);
    int k=0;
    int m=n-1;
    while(k<m)
    {
        swap(&S[k++],&S[m--]);
    }
    int count=0;
    int i=n-1;
    while(!isSolution(S,n))
    {

        while(S[i]=='R')
        {
            i--;
        }
        S[i]='R';
        i++;
        while(i<n)
        {
            S[i]='B';
            i++;
        }
        i--;
        count++;
    }
    printf("%d",count);
    return 0;
}

int isSolution(char *S,int n)
{
    for(int i=0;i<n;i++)
    {
        if(S[i]=='B')
        {
            return 0;
        }
    }
    return 1;
}


#include<stdio.h>

int main()

{
	int n,i,j,k=0,m;
    scanf("%d",&n);
	char col[n];
	scanf("%s",col);
	loop:
	for(i=0;i<n;i++){
		if(col[i]=='B'){
			col[i]='R';
			k++;
			goto loop;
		}
		else if(col[i]=='R'){
			for(j=i;j<n;j++){
				if(col[j]=='B'){
					col[j]='R';
				for(m=i;m<j;m++){
						col[m]='B';
					}
					k++;
					goto loop;
				}
			}
	}

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


#include<stdio.>
#include<math.h>
int main()
{
    int n,i,j;
    unsigned long k=0;
    scanf("%d",&n);
    char ch[n];
    scanf("%s",ch);
    i=0;
    if(ch[i]=='B'){
        ch[i]='R';
    }
    loop:
    if(ch[i]=='R'){
        for(j=i;j<n;j++){
            if(ch[j]=='B'){
                k=k+pow(2,j);
                ch[j]='R';
                goto loop;
            }
        }
    }
    printf("%lu",k);
    return 0
}


#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
    int n,i;
    unsigned long s=0;
    char c[50];
    scanf("%d",&n);
    printf("\n");
    scaf("%s",&c);
    for(i=0;i<n;i++)
    {
        if(c[i]=='B'){s=s+pow(2,i);}
    }
    printf("%lu",s);

}


#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main(){
	int n;
	scanf("%d",&n);
	char* str = (char*)malloc(n*sizeof(char));
	scanf("%s",str);getchar();
	for(int i=0;i<n;i++){
		if(n-i>=3 && str[i]=='o' && str[i+1]=='g' && str[i+2]=='o'){
			int k=i+3;
			while(n-k>=2 && str[k]=='g' && str[k+1]=='o')k+=2;
			printf("***");
			i=k-1;
		}
		else printf("%c",str[i]);
	}
	free(str);
}


#include<stdio.h>
#include<string.h>
int main()
{
    int T;
    scanf("%d",&T);
    char s[200]="";
    getchar();
    for (int i=0;i<T;i++)
        s[i]=getchar();
    for (int i=0;i<T;)
    {
        //printf("1");
        if (s[i]!='o')
        {putchar(s[i]);
        i++;
        continue;}
        if (s[i+1]=='g'&&s[i+2]=='o')
        {
            printf("***");
            i+=3;
            while (s[i]=='g'&&s[i+1]=='o')
            {
                i+=2;
            }
        }
        else putchar(s[i]);
    }
}


#include <stdio.h>

struct dxy
{
	long long d;
	long long x;
	long long y;
};

long long gcd(long long a, long long b)
{
	 return (a*b == 0) ? (a + b) : gcd(b, a%b);
}

struct dxy ext_euc(long long a, long long b)
{
	long long x, y;
	struct dxy ans;
	if (b == 0)
	{
		ans.d = a;
		ans.x = 1;
		ans.y = 0;
		return ans;
	}

	ans = ext_euc(b, a%b);
	x = ans.y;
	y = ans.x - (a/b)*ans.y;

	ans.x = x;
	ans.y = y;
	return ans;
}

long long box(long long numer, long long denom)
{
	if (numer % denom == 0 || numer * denom >= 0)
	{
		return numer / denom;
	}

	return (numer / denom) - 1;
}

int main()
{
	long long a1, a2, b1, b2;
	long long L, R;
	long long alpha1, alpha2, r, start, end;
	long long p, p1, q, i, j;
	long long hcf;
	struct dxy temp;

	scanf("%lld %lld %lld %lld %lld %lld", &a1, &b1, &a2, &b2, &L, &R);

	hcf = gcd(a1, a2);
	if ((b2 - b1) % hcf != 0)
	{
		printf("%d\n", 0);
		return 0;
	}

	r = box((b2 - b1), hcf);
	alpha1 = box(a1, hcf);
	alpha2 = box(a2, hcf);

	temp = ext_euc(alpha1, -alpha2);
	p = temp.x * r;
	p1 = temp.y * r;

	start = box((L-b1), a1) + 1;
	start -= ((L-b1) % a1) == 0 ? 1 : 0;
	end = box((R-b1), a1);

	q = box((start-p), alpha2) + 1;
	q -= ((start-p) % alpha2) == 0 ? 1 : 0;

	j = 0;
	for (i = q; i <= box((end-p), alpha2); i++)
	{
		if (p + i*alpha2 >=0 && p1 + i*alpha1 >= 0)
		{
			j++;
		}
	}

	//printf("%lld %lld\n", start, end);
	//printf("%lld %lld %lld %lld\n", p, p1, q, r);
	//printf("%lld %lld\n", box((end-p), alpha2), box((start-p), alpha2));
	/*
	if (p + q*alpha2 < 0 || p1 + q*alpha1 < 0)
	{
		printf("%d\n", 0);
		return 0;
	}
	*/
	printf("%lld\n", j);
	return 0;
}


/*
 * 710D
 */

#include <stdio.h>

void egcd(long long greater, long long lesser,
	long long *d, long long *x, long long *y)
{
	long long tx, ty;

	if (lesser == 0) {
		*d = greater;
		*x = 1;
		*y = 0;
		return;
	}

	egcd(lesser, greater % lesser, d, x, y);

	tx = *y;
	ty = *x - (greater / lesser) * (*y);
	*x = tx;
	*y = ty;
}

long long gcd(long greater, long lesser)
{
	if (greater % lesser == 0)
		return lesser;
	return gcd(lesser, greater % lesser);
}

long long left, right, a1, a2, b1, b2;

int main(void)
{
	long long delta, lefti, righti;
	long long d, c1, c2;
	double left0, right0, right1, right2, right3;

	scanf("%lld%lld%lld%lld%lld%lld", &a1, &b1, &a2, &b2, &left, &right);

	if (a2 >= a1)
		egcd(a2, a1, &d, &c2, &c1);
	else
		egcd(a1, a2, &d, &c1, &c2);

	delta = b2 - b1;

	if (delta % d) {
		printf("0\n");
		return 0;
	}

	/* x >= 0 */
	right1 = 1.0 * delta * c1 / a2;

	/* y >= 0 */
	right2 = -1.0 * delta * c2 / a1;

	/* left <= value <= right */
	left0 = 1.0 * delta * c1 / a2 - 1.0 * d * (right - b1) / (1.0 * a1 * a2);
	right3 = 1.0 * delta * c1 / a2 - 1.0 * d * (left - b1) / (1.0 * a1 * a2);

	right0 = right1 < right2 ? right1 : right2;
	right0 = right0 < right3 ? right0 : right3;

	lefti = (long long)left0;
	if (left0 > 0 && lefti != left0)
		lefti += 1;

	righti = (long long)right0;
	if (right0 < 0 && righti != right0)
		righti -= 1;

	printf("%lld\n", lefti > righti ? 0 : righti - lefti + 1);

	return 0;
}


#include <stdio.h>

long long xy[2];

int gcdxy(int a, int b) {
	if (b == 0) {
		xy[0] = 1, xy[1] = 0;
		return a;
	} else {
		int g = gcdxy(b, a % b);
		int tmp;

		tmp = xy[0] - a / b * xy[1];
		xy[0] = xy[1];
		xy[1] = tmp;
		return g;
	}
}

int main() {
	int a1, b1, a2, b2, l, r, g;
	long long x, b, n, k_, l_, cnt, cnt1, cnt2;

	scanf("%d%d%d%d%d%d", &a1, &b1, &a2, &b2, &l, &r);
	/* (a1k + b1 = a2l + b2) = (a1k - a2l = b2 - b1) */
	g = gcdxy(a1, -a2);
	b = (long long) b2 - b1;
	if (b % g != 0)
		printf("0\n");
	else {
		k_ = xy[0] * b / g, l_ = xy[1] * b / g;
		if (g < 0)
			g = -g;
		cnt2 = a2 / g;
		cnt1 = a1 / g;
		cnt = (long long) a1 / g * a2;
		k_ = (k_ % cnt2 + cnt2) % cnt2;
		l_ = (l_ % cnt1 + cnt1) % cnt1;
		x = a1 * k_ + b1 > a2 * l_ + b2 ? a1 * k_ + b1 : a2 * l_ + b2;
		n = 0;
		if (x >= l && x <= r)
			n = (r - x + 1 + cnt - 1) / cnt;
		else if (x < l)
			n = (r - x + 1 + cnt - 1) / cnt - (l - 1 - x + 1 + cnt - 1) / cnt;
		printf("%lld\n", n);
	}
	return 0;
}


#include <stdio.h>

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

struct dxy
{
	long long d;
	long long x;
	long long y;
};

long long gcd(long long a, long long b)
{
	 return (a*b == 0) ? (a + b) : gcd(b, a%b);
}

struct dxy ext_euc(long long a, long long b)
{
	long long x, y;
	struct dxy ans;
	if (b == 0)
	{
		ans.d = a;
		ans.x = 1;
		ans.y = 0;
		return ans;
	}

	ans = ext_euc(b, a%b);
	x = ans.y;
	y = ans.x - (a/b)*ans.y;

	ans.x = x;
	ans.y = y;
	return ans;
}

long long box(long long numer, long long denom)
{
	if (numer % denom == 0 || (numer >=0 && denom >= 0) || (numer < 0 && denom < 0))
	{
		return numer / denom;
	}

	return (numer / denom) - 1;
}

int main()
{
	long long a1, a2, b1, b2;
	long long L, R;
	long long alpha1, alpha2, r, start, end;
	long long p, p1, q, q1, i, j, ans, base;
	long long hcf;
	struct dxy temp;

	scanf("%lld %lld %lld %lld %lld %lld", &a1, &b1, &a2, &b2, &L, &R);

	hcf = gcd(a1, a2);
	if ((b2 - b1) % hcf != 0)
	{
		printf("%d\n", 0);
		return 0;
	}

	r = box((b2 - b1), hcf);
	alpha1 = box(a1, hcf);
	alpha2 = box(a2, hcf);

	temp = ext_euc(alpha1, -alpha2);
	p = temp.x * r;
	p1 = temp.y * r;
	if (temp.d < 0)
	{
		p = -p;
		p1 = -p1;
	}

	start = box((L-b1), a1) + 1;
	//printf("start = %lld\n", start);
	start -= ((L-b1) % a1) == 0 ? 1 : 0;
	end = box((R-b1), a1);

	q = box((start-p), alpha2) + 1;
	q -= ((start-p) % alpha2) == 0 ? 1 : 0;
	q1 = box((end-p), alpha2);
	//printf("q1 = %lld\n", q1);

	base = box(-p, alpha2) + 1;
	base -= (p % alpha2) == 0 ? 1 : 0;
	q = max(q, base);
	//printf("q = %lld\n", q);

	base = box(-p1, alpha1) + 1;
	base -= (p1 % alpha1) == 0 ? 1 : 0;
	q = max(q, base);
	//printf("q = %lld\n", q);

	ans = q1 - (q - 1);
	//printf("ans = %lld\n", ans);
	if (ans < 0 )
	{
		ans = 0;
	}

	/*
	j = 0;
	for (i = q; i <= box((end-p), alpha2); i++)
	{
		if (p + i*alpha2 >=0 && p1 + i*alpha1 >= 0)
		{
			j++;
		}
	}
	*/
	//printf("start = %lld, end = %lld\n", start, end);
	//printf("p = %lld, p1 = %lld, q = %lld, r = %lld\n", p, p1, q, r);
	//printf("%lld %lld\n", box((end-p), alpha2), box((start-p), alpha2));
	/*
	if (p + q*alpha2 < 0 || p1 + q*alpha1 < 0)
	{
		printf("%d\n", 0);
		return 0;
	}
	*/
	printf("%lld\n", ans);
	return 0;
}


/*
 * 710D
 */

#include <stdio.h>

long long gcd(long greater, long lesser)
{
	if (greater % lesser == 0)
		return lesser;
	return gcd(lesser, greater % lesser);
}

long long left, right;

void zero_case(long long a1, long long b1, long long b2)
{
	if (a1 == 0) {
		if (b1 != b2)
			printf("0\n");
		else if (left <= b1 && b1 <= right)
			printf("1\n");
		else
			printf("0\n");
	} else {
		if ((b2 - b1) % a1)
			printf("0\n");
		else if (left <= b2 && b2 <= right)
			printf("1\n");
		else
			printf("0\n");
	}
}

int main(void)
{
	long long a1, b1, a2, b2;
	long long y, k, left2, right2, p1, delta, gcdv;
	double tmp;

	scanf("%lld%lld%lld%lld%lld%lld", &a1, &b1, &a2, &b2, &left, &right);

	if (a2 == 0) {
		zero_case(a1, b1, b2);
		return 0;
	} else if (a1 == 0) {
		zero_case(a2, b2, b1);
		return 0;
	}

	gcdv = gcd(a1 > a2 ? a1 : a2, a1 < a2 ? a1 : a2);

	p1 = a1 / gcdv;

	/* here is a lesson */
	tmp = 1.0 * (left - b2) / a2;
	left2 = (long long)tmp;
	if (tmp > 0 && (left - b2) % a2)
		left2 += 1;

	tmp = 1.0 * (right - b2) / a2;
	right2 = (long long)tmp;
	if (tmp < 0 && (right - b2) % a2)
		right2 -= 1;

	delta = b2 - b1;

	for (y = left2; y <= right2; ++y)
		if ((a2 * y + delta) % a1 == 0)
			break;
	if (y < 0) {
		tmp = -1 * y / p1;
		k = (long long)tmp;
		if (y % p1)
			++k;
		y += k * p1;
	}

	if (a2 * y + delta < 0) {
		tmp = -1.0 * (a2 * y + delta) / (a2 * p1);
		k = (long long)tmp;
		if ((a2 * y + delta) % (a2 * p1))
			k += 1;
		y += k * p1;
	}

	printf("%lld\n", y > right2 ? 0 : (right2 - y) / p1 + 1);

	return 0;
}


#include <iostream>
using namespace std;
int main()
{
	int n,i;
	char c[]="ROYGBIV";
	cin >> n;
	cout <<c;
	for(i=0;i<n-7;i++) cout<<c[i%4+3];
	return 0;
}


#include<stdio.h>

int main()
{
    int n;
    scanf("%d",&n);
    r=n%7;
    n=n/7;
    for(i=0;i<n;i++){
        printf("ROYGBIV");
    }
    for(i=0;i<r;i++){
        if(i==0)printf("R");
        else if(i==1)printf("O");
        else if(i==2)printf("Y");
        else if(i==3)printf("G");
        else if(i==4)printf("B");
        else if(i==5)printf("I");
    }
    return 0;
}


#include <stdio.h>
int num;
int n;
char eggs_colour[n] = "ROYGBIV";
int main()
{
    scanf("%d",&n);
    for(num=n;7<=num<=100;num++)
        printf("%c",eggs_colour);
    return 0;
}


#include<stdio.h>
void main(){
	int n,i=1,z,j,f,o;
	scanf("%d",&n);
	z=n/7;
	f=n-(z*7);
	for(j=1;j<=z;j++){
	for(i=1;i<=7;i++){
	if(i==1)
	printf("R");
	else if(i==2)
	printf("Y");
	else if(i==3)
	printf("G");
	else if(i==4)
	printf("B");
	else if(i==5)
	printf("I");
	else if(i==6)
	printf("V");
	else if(i==7)
	printf("O");
}}
for(o=1;o<=f;o++){
if(o==1)
	printf("R");
	else if(o==2)
	printf("Y");
	else if(o==3)
	printf("G");
	else if(o==4)
	printf("B");
	else if(o==5)
	printf("I");
	else if(o==6)
	printf("V");
	}
}


#include<stdio.h>
void main(){
	int n,i=1,z,j,f,o;
	scanf("%d",&n);
	z=n/7;
	f=n-(z*7);
	for(j=1;j<=z;j++){
	for(i=1;i<=7;i++){
	if(i==1)
	printf("R");
	else if(i==2)
	printf("Y");
	else if(i==3)
	printf("G");
	else if(i==4)
	printf("B");
	else if(i==5)
	printf("I");
	else if(i==6)
	printf("V");
	else if(i==7)
	printf("O");
}}
for(o=2;o<=f+1;o++){
    if(o==7)
	printf("Y");
	else if(o==2)
	printf("G");
	else if(o==3)
	printf("B");
	else if(o==4)
	printf("I");
	else if(o==5)
	printf("V");
	else if(i==6)
	printf("O");
	}
}


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

typedef int64_t i64;
typedef int32_t i32;

static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}
static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

const i32 mod = 1000000007;

#define ADD(x, a) do{(x) += (a); if ((x) >= mod) (x) -= mod;} while (0)
#define SUB(x, a) do{(x) += mod - (a); if ((x) >= mod) (x) -= mod;} while (0)

i32 inv (i32 a) {
  i32 t = 1;
  while (a > 1) {
    t = (i64) t * (mod - mod / a) % mod;
    a = mod % a;
  }
  return t;
}

i32 calc (i64 p, const i32 c, const i32 k) {
  i32 *dp = (i32 *) calloc (c + 1, sizeof (i32));
  dp[c] = 1;
  i32 *prob = (i32 *) calloc (c + 1, sizeof (i32));
  for (i32 i = 0; i <= c; ++i) {
    prob[i] = inv (i + 1);
  }
  for (i32 i = 0; i < k; ++i) {
    i32 sum = 0;
    for (i32 j = 0; j <= c; ++j) {
      i32 v = (i64) prob[j] * dp[j] % mod;
      ADD(sum, v);
    }
    for (i32 j = 0; j <= c; ++j) {
      i32 assign = sum;
      i32 v = (i64) prob[j] * dp[j] % mod;
      SUB(sum, v);
      dp[j] = assign;
    }
  }
  p %= mod;
  i32 ans = 0;
  for (i32 i = c; i >= 0; --i) {
    ans = ((i64) p * ans + dp[i]) % mod;
  }
  free (dp);
  free (prob);
  return ans;
}

void run (void) {
  i64 n = read_int();
  i32 k = read_int();
  i64 ans = 1;
  for (i64 p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    i32 c = 0;
    while (n % p == 0) {
      n /= p;
      ++c;
    }
    ans = ans * calc (p, c, k) % mod;
  }
  if (n > 1) ans = ans * calc (n, 1, k) % mod;
  print_int (ans);
  puts ("");
}

int main (void) {
  run ();
  return 0;
}


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

typedef long long int int64;

static void printInt(int64 n){
  if(n<0){putchar('-');n=-n;}
  if(n==0){putchar('0');return;}
  int s[20];int len=0;
  while(n>0){s[len++]=n%10+'0';n/=10;}
  while(len>0){putchar(s[--len]);}
}
static int64 readInt(void){
  int prev='\0';int c=getchar();
  while(!('0'<=c && c<='9')){prev=c;c=getchar();}
  int64 res=0;
  while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}
  return prev=='-'?-res:res;
}

#define POS(i,j) ((i)*(c+1)+(j))

const int mod=1000000007;

int inv(int a){
  int t=1;
  while(a>1){
    t=(int64)t*(mod-mod/a)%mod;
    a=mod%a;
  }
  return t;
}

void run(void){
  int64 n=readInt();
  int k=readInt();
  int ans=1;
  int64 p;
  for(p=2;p*p<=n;p++){
    if(n%p!=0) continue;
    int c=0;
    while(n%p==0){
      n/=p;
      c++;
    }
    int *dp=(int *)calloc((k+1)*(c+1),sizeof(int));
    dp[POS(0,c)]=1;
    int i,j,l;
    for(i=0;i<k;i++){
      for(j=0;j<=c;j++){
	for(l=0;l<=j;l++){
	  dp[POS(i+1,l)]+=(int64)dp[POS(i,j)]*inv(j+1)%mod;
	  dp[POS(i+1,l)]%=mod;
	}
      }
    }
    int local=0;
    for(i=0,j=1;i<=c;i++,j=(int64)j*p%mod) local=(local+(int64)j*dp[POS(k,i)])%mod;
    ans=(int64)ans*local%mod;
    free(dp);
  }
  if(n>1){
    int dp[2]={0,1};
    for(int i=0;i<k;i++){
      dp[0]=(dp[0]+(int64)dp[1]*inv(2))%mod;
      dp[1]=(int64)dp[1]*inv(2)%mod;
    }
    ans=ans*(dp[0]+(int64)n%mod*dp[1]%mod)%mod;
  }
  printInt(ans);
  putchar('\n');
}

int main(void){
  run();
  return 0;
}


#include <stdio.h>

#define MD	1000000007
#define L	50
#define K	10000

long long dp[L + 1][L + 1][K + 1];

void init() {
	static long long dq[L + 1][L + 1][K + 1];
	static int inv[L + 2];
	int i1, i2, i, j;

	for (i = 1; i <= L + 1; i++) {
		long long x = 1;

		while (x % i != 0)
			x += MD;
		inv[i] = x / i % MD;
	}
	for (i1 = 0; i1 <= L; i1++) {
		dp[i1][i1][0] = dq[i1][i1][0] = 1;
		for (i2 = i1 + 1; i2 <= L; i2++)
			dq[i1][i2][0] = (dq[i1][i2][0] + dq[i1][i2 - 1][0]) % MD;
		for (j = 1; j <= K; j++)
			for (i2 = i1; i2 <= L; i2++) {
				dq[i1][i2][j] = dp[i1][i2][j] = dq[i1][i2][j - 1] * inv[i2 + 1] % MD;
				if (i2 > i1)
					dq[i1][i2][j] = (dq[i1][i2][j] + dq[i1][i2 - 1][j]) % MD;
			}
	}
}

int solve(long long a, int cnt, int k) {
	int i, sum;
	long long p;

	a %= MD;
	p = 1;
	sum = 0;
	for (i = 0; i <= cnt; i++) {
		sum = (sum + p * dp[i][cnt][k]) % MD;
		p = p * a % MD;
	}
	return sum;
}

int main() {
	long long n, ans;
	int k, a;

	scanf("%lld%d", &n, &k);
	init();
	ans = 1;
	for (a = 2; a <= n / a; a++)
		if (n % a == 0) {
			int cnt = 0;

			while (n % a == 0) {
				n /= a;
				cnt++;
			}
			ans = ans * solve(a, cnt, k) % MD;
		}
	if (n > 1)
		ans = ans * solve(n, 1, k) % MD;
	printf("%lld\n", ans);
	return 0;
}


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

typedef int64_t i64;
typedef int32_t i32;

static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}
static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

const i32 mod = 1000000007;

#define ADD(x, a) do{(x) += (a); if ((x) >= mod) (x) -= mod;} while (0)
#define SUB(x, a) do{(x) += mod - (a); if ((x) >= mod) (x) -= mod;} while (0)

i32 inv (i32 a) {
  i32 t = 1;
  while (a > 1) {
    t = (i64) t * (mod - mod / a) % mod;
    a = mod % a;
  }
  return t;
}

i32 calc (const i64 p, const i32 c, const i32 k) {
  i32 *dp = (i32 *) calloc (c + 1, sizeof (i32));
  dp[c] = 1;
  i32 *prob = (i32 *) calloc (c + 1, sizeof (i32));
  for (i32 i = 0; i <= c; ++i) {
    prob[i] = inv (i + 1);
  }
  for (i32 i = 0; i < k; ++i) {
    i32 sum = 0;
    for (i32 j = 0; j <= c; ++j) {
      i32 v = (i64) prob[j] * dp[j] % mod;
      ADD(sum, v);
    }
    for (i32 j = 0; j <= c; ++j) {
      i32 assign = sum;
      i32 v = (i64) prob[j] * dp[j] % mod;
      SUB(sum, v);
      dp[j] = assign;
    }
  }
  i32 ans = 0;
  for (i32 i = c; i >= 0; --i) {
    ans = ((i64) p * ans + dp[i]) % mod;
  }
  free (dp);
  free (prob);
  return ans;
}

void run (void) {
  i64 n = read_int();
  i32 k = read_int();
  i64 ans = 1;
  for (i64 p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    i32 c = 0;
    while (n % p == 0) {
      n /= p;
      ++c;
    }
    ans = ans * calc (p, c, k) % mod;
  }
  if (n > 1) ans = ans * calc (n, 1, k) % mod;
  print_int (ans);
  puts ("");
}

int main (void) {
  run ();
  return 0;
}
220x218x26x45:gori ymkw$ emacs 1.c
220x218x26x45:gori ymkw$ gg 1.c
220x218x26x45:gori ymkw$ cat 1.c
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int64_t i64;
typedef int32_t i32;

static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}
static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}

const i32 mod = 1000000007;

#define ADD(x, a) do{(x) += (a); if ((x) >= mod) (x) -= mod;} while (0)
#define SUB(x, a) do{(x) += mod - (a); if ((x) >= mod) (x) -= mod;} while (0)

i32 inv (i32 a) {
  i32 t = 1;
  while (a > 1) {
    t = (i64) t * (mod - mod / a) % mod;
    a = mod % a;
  }
  return t;
}

i32 calc (i64 p, const i32 c, const i32 k) {
  i32 *dp = (i32 *) calloc (c + 1, sizeof (i32));
  dp[c] = 1;
  i32 *prob = (i32 *) calloc (c + 1, sizeof (i32));
  for (i32 i = 0; i <= c; ++i) {
    prob[i] = inv (i + 1);
  }
  for (i32 i = 0; i < k; ++i) {
    i32 sum = 0;
    for (i32 j = 0; j <= c; ++j) {
      i32 v = (i64) prob[j] * dp[j] % mod;
      ADD(sum, v);
    }
    for (i32 j = 0; j <= c; ++j) {
      i32 assign = sum;
      i32 v = (i64) prob[j] * dp[j] % mod;
      SUB(sum, v);
      dp[j] = assign;
    }
  }
  p %= mod;
  i32 ans = 0;
  for (i32 i = c; i >= 0; --i) {
    ans = ((i64) p * ans + dp[i]) % mod;
  }
  free (dp);
  free (prob);
  return ans;
}

void run (void) {
  i64 n = read_int();
  i32 k = read_int();
  i64 ans = 1;
  for (i64 p = 2; p * p <= n; ++p) {
    if (n % p != 0) continue;
    i32 c = 0;
    while (n % p == 0) {
      n /= p;
      ++c;
    }
    ans = ans * calc (p, c, k) % mod;
  }
  if (n > 1) ans = ans * calc (n, 1, k) % mod;
  print_int (ans);
  puts ("");
}

int main (void) {
  run ();
  return 0;
}


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

int main()
{
    int a,ta;
    int b,tb;
    int hh,mm;
    int i;
    int dem=0;
    scanf("%d%d%d%d%d:%d",&a,&ta,&b,&tb,&hh,&mm);
    int x = hh*60+mm+ta;
    int y = hh*60+mm;
    for(i=5*60; i<=23*60+59; i+=b)
    {
        if(i < x  &&  i+tb > y )
            dem++;
    }
    printf("%d",dem);

    return 0;
}


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

#define INIT_DAY 300
#define END_DAY 1440

int main(int argc, char* argv[]) {
	int a, ta, b, tb;
	int hh, mm;
	int start, end;
	int init_run;
    int acum = 0;

	scanf("%i %i", &a, &ta);
	scanf("%i %i", &b, &tb);
	scanf("%d:%d", &hh, &mm);
	start = (hh * 60) + mm;
	end = start + ta;

	init_run = INIT_DAY;
	while (init_run < END_DAY) {
		if ( ((init_run + tb) > start) &&
   		     ( end > init_run) ) {
   			acum++;
   		}
    	init_run = init_run + b;
    }
    printf("%i\n", acum);
   	return 0;
}


#include<stdio.h>
main()
{
	int i,a,b,ta,tb,h,m,t,count=0;
	scanf("%d %d",&a,&ta);
	scanf("%d %d",&b,&tb);
	scanf("%d:%d",&h,&m);
	t=h*60+m;
	for(i=300;i<1440;i=i+b){
		if(i+tb>t && i<t+ta){
			count++;
		}
	}
	printf("%d\n",count);

}


#include<stdio.h>
char s[100];
int main() {
    int k = 0,true=1, n, pos = 1, neg = 0;
    while (true) {
        char c;
        scanf(" %c", &c);
        scanf(" %c", &c);

        if (c == '=') break;
        if (c == '+') pos++;
        if (c == '-') neg++;

        s[k++] = c;
    }

    scanf("%d", &n);

    if (pos - n * neg > n || n * pos - neg < n) {
        printf("Impossible\n");

        return 0;
    }

    printf("Possible\n");

    int S = 0,i=0,x=1;
    for (i = 0; i < k; i++) {
        int sgn = 1;
        if (i > 0 && s[i - 1] == '-') sgn = -1;

        if (sgn == 1) pos--;
        if (sgn == -1) neg--;
        for (x = 1; x <= n; x++)
        {
            if (S + x * sgn + pos - n * neg <= n && S + x * sgn + n * pos - neg >= n) {
                printf("%d %c ", x, s[i]);

                S += x * sgn;

                break;
            }
            }
	}

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

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
	int a, ta, b, tb;
	scanf("%d%d%d%d", &a, &ta, &b, &tb);
	int h, min;
	scanf("%d%*c%d", &h, &min);
	min += h * 60 - 300;

	int bdepart = min - tb > 0 ? min - tb : 0;

	int ar = min + ta > 1139 ? 1139 : min + ta;

	printf("%d\n", (ar - 1) / b - (bdepart + b - 1) / b + 1);
	system("pause");
}


#include<stdio.h>
int n, cube[3][6],v[3];

int dfs(int num){
	if (num == 0)return 1;
	for (int i = 0; i < n; i++){
		if (v[i])continue;
		int f = 0;
		for (int j = 0; j < 6; j++)
			if (num % 10 == cube[i][j])f = 1;
		if (!f)continue;
		v[i] = 1;
		if (dfs(num / 10))return 1;
		v[i] = 0;
	}
	return 0;
}
void main(){
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		for (int j = 0; j < 6; j++)scanf("%d", &cube[i][j]);

	for (int i = 0; i < 1000; i++){
		for (int j = 0; j < n; j++)v[j] = 0;
		if (!dfs(i)){
		    printf("%d\n", i - 1);
		    return;
		}
	}
}


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

void *my_malloc(int size)
{
    void *ans = malloc(size);
    if(ans == NULL)
    {
        exit(EXIT_FAILURE);
    }
    return ans;
}

void clear(int *v, int l)
{
    int i;
    for(i = 0; i < l; i ++)
    {
        v[i] = 0;
    }
}

void fun(int *v, int **m, int *order, int i, int k)
{
    if(i == -1)
    {
        v[k] = 1;
        return;
    }
    int j;
    for(j = 0; j < 6; j ++)
    {
        fun(v, m, order, i - 1, k * 10 + m[order[i]][j]);
    }
}

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

	int *v = my_malloc((int)pow(10, n) * sizeof(int));
	int **m = my_malloc(n * sizeof(int*));

	clear(v, (int)pow(10, n));

	int i, j;
	for(i = 0; i < n; i ++)
	{
	    m[i] = my_malloc(6 * sizeof(int));
	    for(j = 0; j < 6; j ++)
	    {
	        scanf("%d", m + i + j);
	    }
	}

	if(n == 3)
	{
	    int *order = my_malloc(3 * sizeof(int));
	    for(i = 0; i < n; i ++)
    	{
    	    int x, y, z;
    	    for(x = 0; x < n; x ++)
    	    {
    	        for(y = 0; y < n; y ++)
    	        {
    	            if(y == x)
    	            {
    	                continue;
    	            }
    	            for(z = 0; z < n; z ++)
    	            {
    	                if(z == x || z == y)
    	                {
    	                    continue;
    	                }
    	                order[0] = x, order[1] = y, order[2] = z;
    	                fun(v, m, order, i, 0);
    	            }
    	        }
    	    }
    	}
    	free(order);
	}else if(n == 2)
	{
	    int *order = my_malloc(2 * sizeof(int));
	    for(i = 0; i < n; i ++)
    	{
    	    int x, y;
    	    for(x = 0; x < n; x ++)
    	    {
    	        for(y = 0; y < n; y ++)
    	        {
    	            if(y == x)
    	            {
    	                continue;
    	            }
    	            order[0] = x, order[1] = y;
    	            fun(v, m, order, i, 0);
    	        }
    	    }
    	}
    	free(order);
	}else
	{
	    int *order = my_malloc(sizeof(int));
	    for(i = 0; i < n; i ++)
    	{
    	    int x, y;
    	    for(x = 0; x < n; x ++)
    	    {
    	        order[0] = x;
    	        fun(v, m, order, i, 0);
    	    }
    	}
    	free(order);
	}

	int ans = 1;
	while(ans < (int)pow(10, n))
	{
	    if(!v[ans])
	    {
	        break;
	    }
	    ans ++;
	}

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

	free(v);
	free(m);

	return 0;
}


#include<stdio.h>
int n, cube[3][6],v[3];

int dfs(int num){
	if (num == 0)return 1;
	for (int i = 0; i < n; i++){
		if (v[i])continue;
		int f = 0;
		for (int j = 0; j < 6; j++)
			if (num % 10 == cube[i][j])f = 1;
		if (!f)continue;
		v[i] = 1;
		if (dfs(num / 10))return 1;
		v[i] = 0;
	}
	return 0;
}
int main(){
	scanf("%d", &n);
	for (int i = 0; i < 3; i++)
		for (int j = 0; j < 6; j++)scanf("%d", &cube[i][j]);

	for (int i = 0; i < 1000; i++){
		for (int j = 0; j < n; j++)v[j] = 0;
		if (!dfs(i))return printf("%d\n", i - 1);
	}
}


#include<stdio.h>
#include<math.h>
#include<string.h>
using namespace std;
double x,y,z;
double a[9];

int main()
{
	char count[9][10]={"x^y^z",
                      "x^z^y",
					  "(x^y)^z",
					  "y^x^z",
					  "y^x^z",
					  "(y^x)^z",
					  "z^x^y",
					  "z^y^x",
					  "(z^x)^y"} ;
	int i,max;
	scanf("%lf%lf%lf",&x,&y,&z);
	a[0]=pow(y,z)*log(x);
	a[1]=pow(z,y)*log(x);
	a[2]=y*z*log(x);
	a[3]=pow(x,z)*log(y);
	a[4]=pow(z,x)*log(y);
	a[5]=x*z*log(y);
	a[6]=pow(x,y)*log(z);
	a[7]=pow(y,x)*log(z);
	a[8]=x*y*log(z);
	for(i=1,max=0;i<=8;i++)
	{
		if(a[i]>a[max])max=i;
	}
	printf("%s",count[max]);
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<bits/stdc++.h>
using namespace std;
double x,y,z;
double a[9];

int main()
{
	char count[9][10]={"x^y^z",
                      "x^z^y",
					  "(x^y)^z",
					  "y^x^z",
					  "y^x^z",
					  "(y^x)^z",
					  "z^x^y",
					  "z^y^x",
					  "(z^x)^y"} ;
	int i,max;
	scanf("%lf%lf%lf",&x,&y,&z);
	a[0]=pow(y,z)*log(x);
	a[1]=pow(z,y)*log(x);
	a[2]=y*z*log(x);
	a[3]=pow(x,z)*log(y);
	a[4]=pow(z,x)*log(y);
	a[5]=x*z*log(y);
	a[6]=pow(x,y)*log(z);
	a[7]=pow(y,x)*log(z);
	a[8]=x*y*log(z);
	for(i=1,max=0;i<=8;i++)
	{
		if(a[i]>a[max])max=i;
	}
	printf("%s",count[max]);
}


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

int main () {

	double x, y, z;

	double max;
	int ind = 0;

	scanf("%lf %lf %lf", &x, &y, &z);

	if (x - 1.0 < 1e-6 && y - 1.0 < 1e-6 && z - 1.0 < 1e-6) {

		max = 1000000;

		if (z * log(y) + log(log(1 / x)) - max < -1e-6) {
			max = z * log(y) + log(log(1 / x));
			ind = 1;
		}
// printf("%.15lf\n", z * log(y) + log(log(1 / x)));
		if (y * log(z) + log(log(1 / x)) - max < -1e-6) {
			max = y * log(z) + log(log(1 / x));
			ind = 2;
		}
// printf("%.15lf\n", y * log(z) + log(log(1 / x)));
		if (log(y) + log(z) + log(log(1 / x)) - max < -1e-6) {
			max = log(y) + log(z) + log(log(1 / x));
			ind = 3;
		}
// printf("%.15lf\n", log(y) + log(z) + log(log(1 / x)));

	if (z * log(x) + log(log(1 / y)) - max < -1e-6) {
			max = z * log(x) + log(log(1 / y));
			ind = 5;
		}
// printf("%.15lf\n", z * log(x) + log(log(1 / y)));
		if (x * log(z) + log(log(1 / y)) - max < -1e-6) {
			max = x * log(z) + log(log(1 / y));
			ind = 6;
		}
// printf("%.15lf\n", x * log(z) + log(log(1 / y)));
		if (log(x) + log(z) + log(log(1 / y)) - max < -1e-6) {
			max = log(x) + log(z) + log(log(1 / y));
			ind = 7;
		}
// printf("%.15lf\n", log(x) + log(z) + log(log(1 / y)));

	if (y * log(x) + log(log(1 / z)) - max < -1e-6) {
			max = y * log(x) + log(log(1 / z));
			ind = 9;
		}
// printf("%.15lf\n", y * log(x) + log(log(1 / z)));
		if (x * log(y) + log(log(1 / z)) - max < -1e-6) {
			max = x * log(y) + log(log(1 / z));
			ind = 10;
		}
// printf("%.15lf\n", x * log(y) + log(log(1 / z)));
		if (log(x) + log(y) + log(log(1 / z)) - max < -1e-6) {
			max = log(x) + log(y) + log(log(1 / z));
			ind = 11;
		}
// printf("%.15lf\n", log(x) + log(y) + log(log(1 / z)));

	} else {

		max = -1000;

		if (x - 1.0 > 0.01) {
			if (z * log(y) + log(log(x)) - max > 1e-6) {
				max = z * log(y) + log(log(x));
				ind = 1;
			}
// printf("%.15lf\n", z * log(y) + log(log(x)));
			if (y * log(z) + log(log(x)) - max > 1e-6) {
				max = y * log(z) + log(log(x));
				ind = 2;
			}
// printf("%.15lf\n", y * log(z) + log(log(x)));
			if (log(y) + log(z) + log(log(x)) - max > 1e-6) {
				max = log(y) + log(z) + log(log(x));
				ind = 3;
			}
// printf("%.15lf\n", log(y) + log(z) + log(log(x)));
		}

		if (y - 1.0 > 0.01) {
			if (z * log(x) + log(log(y)) - max > 1e-6) {
				max = z * log(x) + log(log(y));
				ind = 5;
			}
// printf("%.15lf\n", z * log(x) + log(log(y)));
			if (x * log(z) + log(log(y)) - max > 1e-6) {
				max = x * log(z) + log(log(y));
				ind = 6;
			}
// printf("%.15lf\n", x * log(z) + log(log(y)));
			if (log(x) + log(z) + log(log(y)) - max > 1e-6) {
				max = log(x) + log(z) + log(log(y));
				ind = 7;
			}
// printf("%.15lf\n", log(x) + log(z) + log(log(y)));
		}

		if (z - 1.0 > 0.01) {
			if (y * log(x) + log(log(z)) - max > 1e-6) {
				max = y * log(x) + log(log(z));
				ind = 9;
			}
// printf("%.15lf\n", y * log(x) + log(log(z)));
			if (x * log(y) + log(log(z)) - max > 1e-6) {
				max = x * log(y) + log(log(z));
				ind = 10;
			}
// printf("%.15lf\n", x * log(y) + log(log(z)));
			if (log(x) + log(y) + log(log(z)) - max > 1e-6) {
				max = log(x) + log(y) + log(log(z));
				ind = 11;
			}
// printf("%.15lf\n", log(x) + log(y) + log(log(z)));
		}
	}

	switch (ind) {
		case 1:
			printf("x^y^z\n");
			break;
		case 2:
			printf("x^z^y\n");
			break;
		case 3:
			printf("(x^y)^z\n");
			break;
		case 4:
			printf("(x^z)^y\n");
			break;
		case 5:
			printf("y^x^z\n");
			break;
		case 6:
			printf("y^z^x\n");
			break;
		case 7:
			printf("(y^x)^z\n");
			break;
		case 8:
			printf("(y^z)^x\n");
			break;
		case 9:
			printf("z^x^y\n");
			break;
		case 10:
			printf("z^y^x\n");
			break;
		case 11:
			printf("(z^x)^y\n");
			break;
		case 12:
			printf("(z^y)^x\n");
			break;
		default:
			printf("ERROR\n");
	}

	return 0;

}


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

double aa[12];
int sign[12];

int compare(const void *a, const void *b) {
	int i = *(int *) a;
	int j = *(int *) b;

	if (sign[i] != sign[j])
		return sign[j] - sign[i];
	if (sign[i] == 0)
		return i - j;
	return aa[i] == aa[j] ? i - j : aa[i] > aa[j] ? -sign[i] : sign[i];
}

void power(int i, double x, double y, double z) {
	if (x == 1)
		sign[i] = 0;
	else if (x > 1) {
		sign[i] = 1;
		aa[i] = z * log(y) + log(log(x));
	} else {
		sign[i] = -1;
		aa[i] = z * log(y) + log(-log(x));
	}
}

void power_(int i, double x, double yz) {
	if (x == 1)
		sign[i] = 0;
	else if (x > 1) {
		sign[i] = 1;
		aa[i] = log(yz) + log(log(x));
	} else {
		sign[i] = -1;
		aa[i] = log(yz) + log(-log(x));
	}
}

int main() {
	static char ss[12][16] = {
		"x^y^z", "x^z^y", "(x^y)^z", "(x^z)^y",
		"y^x^z", "y^z^x", "(y^x)^z", "(y^z)^x",
		"z^x^y", "z^y^x", "(z^x)^y", "(z^y)^x" };
	static int ii[12];
	double x, y, z;
	int i;

	scanf("%lf%lf%lf", &x, &y, &z);
	power(0, x, y, z);
	power(1, x, z, y);
	power_(2, x, y * z);
	power_(3, x, y * z);
	power(4, y, x, z);
	power(5, y, z, x);
	power_(6, y, x * z);
	power_(7, y, x * z);
	power(8, z, x, y);
	power(9, z, y, x);
	power_(10, z, x * y);
	power_(11, z, x * y);
	for (i = 0; i < 12; i++)
		ii[i] = i;
	qsort(ii, 12, sizeof *ii, compare);
	printf("%s\n", ss[ii[0]]);
	return 0;
}


#include<stdio.h>
long long int dk(long long int m,long long int n[]);
long long int main()
{
long long int a,b,c,d=0,i,e=0,k=0,g=0;
long long int p[10000]={0},q[10000],f[10000];
scanf("%I64d%I64d",&a,&c);
d=dk(a,p);
e=dk(c,q);
if(d==e)
{
next:
for(i=0;i<d;i++)
{
k=0;
while(((p[i]+k)%3)!=q[i])
{
k++;
}
f[i]=k;
}
}
else
{
if(d>e)
{
while(d!=e)
{
q[e]=0;
e++;
}
goto next;}
else
{
while(d!=e)
{
p[d]=0;
d++;
}
goto next;}
}
for(i=0;i<d;i++)
{
g=g+f[i]*pow(3,i);
}
printf("%I64d",g);
return(0);
}
long long int dk(long long int m,long long int n[])
{
    int x=0;
while(m>0)
{
n[x++]=m%3;l;;
m=(m-(m%3))/3;
}
return(x);
}


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

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

int n, ar[100010];

int main(){
    int i, j, x, g, flag;

    scanf("%d", &n);
    if (n == 3) puts("27");
    else if (n == 1) puts("4");
    else if (n == 2) puts("22");
    else if (n == 4) puts("58");
    else __builtin_trap();
    return 0;
}


#include<stdio.h>
int main()
{
               int n;
               scanf("%d",&n);
               if(n==1)
                              printf("4");
               else if(n==2)
                              printf("22");
               else if(n==3)
                              printf("27");
               else if(n==4)
                              printf("58");
                else if(n==5)
                              printf("85");
                else if(n==6)
                              printf("94");
                else if(n==7)
                              printf("121");
                else if(n==8)
                              printf("166");
               else if(n==9)
                              printf("202");
                  else if(n==10)
                              printf("265");
                else if(n==11)
                              printf("274");
                 else if(n==12)
                              printf("319");
                 else if(n==13)
                              printf("346");
                 else if(n==14)
                              printf("355");
                 else if(n==15)
                              printf("378");
                  else if(n==16)
                              printf("382");
                  else if(n==17)
                              printf("391");
                  else if(n==18)
                              printf("438");
                 else if(n==19)
                              printf("454");
                  else if(n==20)
                              printf("483");
                else if(n==21)
                              printf("517");
                 else if(n==22)
                              printf("526");
                  else if(n==23)
                              printf("535");
                    else if(n==24)
                              printf("562");
               else if(n==25)
                              printf("576");
                  else if(n==26)
                              printf("588");
                else if(n==27)
                              printf("627");
                else if(n==28)
                              printf("634");
             else if(n==29)
                              printf("636");
              else(n==30)
                           printf("645");

                              return 0;
}


#include <stdio.h>

int main()
{
	int n;

	scanf("%d", &n);

	printf("%d", 30 - a);

	return 0;
}


/*  AUTHOR:AKASH JAIN
*   USERNAME:akash19jain
*   DATE:31/03/2019
*/
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>

int main()
{
    long long t=1;
    //scanf("%lld",&t);
    while(t--)
    {
        long long n;
        scanf("%lld",&n);
        long long a=n*n*n;
        printf("%lld\n",ans);
    }

    return 0;
}


#include <stdio.h>
int man(void)
{
    int a=0;
    scanf("%d",&a);
    printf("%d\n",3*a);
    return 0;
}


#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#define prime 1000000007
int main()
{
	long long num,flag=0;
	scanf("%lli",&num);
	if(num<0)
	{
		flag=1;
		num=-1*num;
	}
	num=num%360;
	if(flag==0)
	{
		if(num<=45)
		{
			printf("0\n");
		}
		else if(num<=135)
		{
			printf("1\n");
		}
		else if(num<=225)
		{
			printf("2\n");
		}
		else if(num<315)
		{
			printf("3\n");
		}
		else printf("0\n");
	}
	else if(flag==1)
	{
		if(num==135)
			printf("2\n");
		else if(num==225)
			printf("1\n");
		else if(num==315)
			printf("0\n");
		else if(num<=45)
		{
			printf("0\n");
		}
		else if(num<=135)
		{
			printf("3\n");
		}
		else if(num<=225)
		{
			printf("2\n");
		}
		else if(num<315)
		{
			printf("1\n");
		}
		else printf("0\n");
	}
	return 0;
}


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

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

long long fucks(long long x){
    if (x >= 0) return x;
    return -x;
}

int main(){
    long long y, i, j, c, d, x;

    while (scanf("%lld", &y) != EOF){
        x = fucks(y) % 360;
        if (y < 0) x = -x;
        if (x < 0) x += 360;

        long long res = 0, min = 1010;
        for (i = 0; i <= 100; i++){
            d = (i * 90) % 360;
            c = fucks(d - x);
            if (c < min) min = c, res = i;
        }

        if ((y % 360) == 0) __builtin_trap();
        printf("%lld\n", res);
    }
    return 0;
}


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

#define M 200000000

int aa[M], bb[M];

int compare(const void *a, const void *b) {
	int i = *(int *) a;
	int j = *(int *) b;

	return bb[j] - bb[i];
}

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

int main() {
	static int ii[M];
	int n, m, i, x, cnt;

	scanf("%d%d", &n, &m);
	for (i = 0; i < m; i++) {
		scanf("%d%d", &aa[i], &bb[i]);
		ii[i] = i;
	}
	qsort(ii, m, sizeof *ii, compare);
	cnt = 0;
	for (i = 0; i < m && n > 0; i++) {
		x = min(aa[ii[i]], n);
		cnt += (x * bb[ii[i]]);
		n -= x;
	}
	printf("%d\n", cnt);
	return 0;
}


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

typedef struct{

    int n_of_matches;
    int n_matchbox;

}container;

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

int main(void) {

    int n, m, cnt = 0, sum = 0;
    scanf("%d %d", &n, &m);

    container arr[m];

    for(int i = 0; i < m; i++){
        scanf("%d", &arr[i].n_matchbox);
        scanf("%d", &arr[i].n_of_matches);
    }

    qsort(arr, m, sizeof(container), cmpfunc);

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

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

        for(int j = 0; j < arr[i].n_matchbox; j++){
            sum += arr[i].n_of_matches;
            cnt++;

            if(cnt == n){
                printf("%d", sum);
                return 0;
            }
        }
    }

    printf("%d", sum);


#include<stdio.h>
#include<string.h>
struct box
{
    int matchbox;
    int match;
} a[20];

int q[12000010];

int main(void)
{
    int n,m,sum,start,i,k,j;
    struct box t;
    while(scanf("%d%d",&n,&m) != EOF)
    {
        for(i = 0;i <m;i++)
            scanf("%d%d",&(a[i].matchbox),&(a[i].match));
        for(i = 0;i < m-1;i++)
            for(j= i+1;j <m;j++)
                if(a[i].match < a[j].match)
                {t=a[i];a[i]=a[j];a[j]=t;}
        for(i = 0,start = 0;i< m;i++)
        {
            for(j = 0;j < a[i].matchbox;j++)
                q[start++] = a[i].match;
        }
        for(i = 0,sum = 0;i < n && i < start;i++)
            sum+=q[i];
        printf("%d\n",sum);
    }
    return 0;
}


#include<stdio.h>
#include<string.h>
struct box
{
    int matchbox;
    int match;
} a[20];

int q[10000010];

int main(void)
{
    int n,m,sum,start,i,k,j;
    struct box t;
    while(scanf("%d%d",&n,&m) != EOF)
    {
        for(i = 0;i <m;i++)
            scanf("%d%d",&(a[i].matchbox),&(a[i].match));
        for(i = 0;i < m-1;i++)
            for(j= i+1;j <m;j++)
                if(a[i].match < a[j].match)
                {t=a[i];a[i]=a[j];a[j]=t;}
        for(i = 0,start = 0;i< m;i++)
        {
            for(j = 0;j < a[i].matchbox;j++)
                q[start++] = a[i].match;
        }
        for(i = 0,sum = 0;i < n && i < start;i++)
            sum+=q[i];
        printf("%d\n",sum);
    }
    return 0;
}


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

int minimal_changes(int n)
{
    int ret , min , found = 0, other , ten_pow = 1;
    double res = sqrt((double)n);
    if(n == 0) return -1;
    if(res == (int)res)
    {
        return 0;
    }
    while(n / ten_pow)
    {
        other = (n /(10 * ten_pow)) * ten_pow + n % ten_pow ;
        ret = minimal_changes(other);
        if(ret != -1)
        {
            if(!found)
            {
                min = ret;
                found = 1;
            }
            min = ret < min ? ret : min;
        }
        ten_pow *= 10;
    }
    if(found)
    {
        return 1 + min;
    }
    return -1;
}

int main()
{
    int n ;
    scanf("%d" , &n);
    printf("%d" , minimal_changes(n));
    return 0;
}


#include<stdio.h>
#include<math.h>
int main()
{
	long long n;
	int c,i=0,rev[10],rev1[10],num1[10],num[10],j,k,m,l1,l,p,q,count=0;
	scanf("%I64d",&n);
	c=n;
	while(c!=0)
	{
		rev[i]=c%10;
		c/=10;
		i++;
	}
	l=i-1;

	//for(j=l,k=0;j>0,k<l+1;j--,k++)num[j]=rev[k];
	for(i=n;i>0;i--)
	{
		float sqrti=sqrt(i);
		int sqrtii=sqrt(i);
		if(sqrti-sqrtii==0)
		{
			count=0;
			j=0;
			c=i;
			while(c!=0)
			{
				rev1[j]=c%10;
				c/=10;
				j++;
			}
			l1=j-1;

			//for(k=l1,m=0;k>=0,m<l1+1;k--,m++)num1[k]=rev1[m];
			q=l;
			for(p=l1;p>=0;p--)
			{
				for(;q>=0;q--)
				{
					if(rev1[p]==rev[q])
					{
						count++;
						q--;
						break;
					}
					else if(q<p)goto start;
				}
			}
			start:
			if(count>0&&count==l1+1)
			{
				printf("%d",l-l1);
				return 0;
			}
		}
	}
	printf("-1");
}


#include<stdio.h>
#include<math.h>
int main()
{
	long long n;
	int c,i=0,rev[10],rev1[10],num1[10],num[10],j,k,m,l1,l,p,q,count=0;
	scanf("%I64d",&n);
	c=n;
	while(c!=0)
	{
		rev[i]=c%10;
		c/=10;
		i++;
	}
	l=i-1;

	for(j=l,k=0;j>0,k<l+1;j--,k++)num[j]=rev[k];
	for(i=n;i>0;i--)
	{
		float sqrti=sqrt(i);
		int sqrtii=sqrt(i);
		if(sqrti-sqrtii==0)
		{
			count=0;
			j=0;
			c=i;
			while(c!=0)
			{
				rev1[j]=c%10;
				c/=10;
				j++;
			}
			l1=j-1;

			for(k=l1,m=0;k>=0,m<l1+1;k--,m++)num1[k]=rev1[m];
			q=0;
			for(p=0;p<l1+1;p++)
			{

				for(;q<l+1;q++)
				{
					if(num1[p]==num[q])
					{
						count++;
						q++;
						break;
					}
					else if((l-q)<(l1-p))goto start;
				}
			}
			start:
			if(count>0&&count==l1+1)
			{
				printf("%d",l-l1);
				return 0;
			}
		}
	}
	printf("-1");
}


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

int minimal_changes(int n)
{
    int ret , min , found = 0, other , ten_pow = 1;
    double res = sqrt((double)n);
    if(res == (int)res)
    {
        return 0;
    }
    if(n == 0) return -1;
    while(n / ten_pow)
    {
        other = (n /(10 * ten_pow)) * ten_pow + n % ten_pow ;
        ret = minimal_changes(other)
        if(ret != -1)
        {
            if(!found)
            {
                min = ret;
                found = 1;
            }
            min = ret < min ? ret : min;
        }
        ten_pow *= 10;
    }
    if(found)
    {
        return 1 + min;
    }
    return -1;
}

int main()
{
    int n ;
    scanf("%d" , &n);
    printf("%d" , minimal_changes(n));
    return 0;
}


#include<stdio.h>
#define N 1123456
#define M 112233

long long a[10];
long long aa[10];
long long b[10];
int c[M];
int cc[M];
char d[N];
int next[N];
int pre[N];
long long output;
long long temp;

void prime( int n )
{
  int i, o, p, j, k, l;
  for (i = 0;i<=n+10;++i)
  {
    d[i] = 1;
    next[i] = i+1;
    pre[i] = i-1;
  }
  d[0] = 0; d[1] = 0;
  for (i=2;i<=n;i=next[i])
  {
    for (j=next[i];j<=n;j=next[j])
      if (j%i == 0)
      {
        p = pre[j];
        next[p] = next[j];
        pre[next[j]] = p;
        d[j] = 0;
      }
  }
  c[0] = 0;
  for (i=0;i<=n;++i)
    if (d[i] == 1)
    {
      c[++c[0]] = i;
//printf( "p = %d\n", i );
    }
//printf( "%d\n", c[0] );
}

int dd(int x )
{
  int p;
  while( x>=10 )
  {
    p = 0;
    while (x>0)
    {
      p += x%10;
      x = x/10;
    }
    x = p;
  }
  return( x );
}

int ddd(long long x )
{
  long long p;
  while( x>=(long long)10 )
  {
    p = 0;
    while (x>0)
    {
      p += x%10;
      x = x/10;
    }
    x = p;
  }
  return( (int)x );
}

void shu_chu( long long k )
{
  int a[100];
  int i, j;
  i = 0;
  if (k==0)
  {
    printf("0\n" );
    return;
  }
  while(k!=0)
  {
    a[i++] = k%10;
    k = k/10;
  }
  while( i>0 ) printf( "%d", a[--i] );
  printf( "\n" );
}

main()
{
  int i, o, p, j, k, l, n, m, q;
  scanf( "%d", &n );
  if (n==1) {printf( "0\n" ); return 0;}
  prime( n );
  for (i=0;i<10;++i) {a[i] = 0; b[i] = 0;}
  a[1] = 1; b[1] = 1;

  for (i=2;i<=n;++i)
  {
    p = i;
    temp = (long long)1;
    for (j=1;j<=c[0];++j)
    {
      q = 0;
      while( p%c[j] == 0 )
      {
        ++q;
        p /= c[j];
//printf("%d %d\n", p, j );
      }
      ++q;
//if (c[j]==i) cc[j] = 0;
      temp *= (long long)q;
    }
temp -= 2;
//printf(" temp = %d %lld\n", i, temp );
    for (j=0;j<=9;++j) aa[j] = (long long)0;
    for (j=0;j<=9;++j)
    {
      aa[dd(j*i)] += a[j];
    }
    //++a[dd(j)];
    for (j=0;j<=9;++j) output+=(long long)2*a[j]*aa[j]; //2 usual

    output += aa[dd(i)] * (long long)2; //2 special

    output -= (long long)2;

    ++a[dd(i)];

    output += a[ddd((long long)i*(long long)i)]; //3

    output += b[dd(i)] - temp;  //1
    for (j=0;j<=9;++j) b[j] += aa[j] * 2;
    b[ddd((long long)i*(long long)i)] += (long long)1;
  }

//  printf( "%lld\n", output );
  shu_chu( output );
  return 0;
}


#include <stdio.h>
int main(){
  int n ;
  scanf("%d",&n);
  int r = n % 9;
  int  a[9];
  for(int i=0;i<9;i++){
    if( i <=r && i != 0 )
      a[i] = n / 9 +1 ;
    else
      a[i] = n /9  ;
  }
  long long  ans=0;
  for(int i=0;i<9;i++)
    for(int j=i+1;j<9;j ++ )
      ans += (long long) a[i]*a[j]*a[i*j%9];

  ans *=2;
  for(int i=0;i<9;i++)
    ans+=(long long) a[i]*a[i]*a[i*i%9];

  for(int i =1;i*i<=n;i++){
    int m = n / i - (i-1) ;
    ans -= 2*m  - 1;
  }

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


#include<stdio.h>
long long c[9],z;
int n;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        c[i%9]++,z-=n/i;
    for(int i=0;i<9;i++)
        for(int j=0;j<9;j++)
            z+=c[i]*c[j]*c[i*j%9];
    printf("%I64d",z);
    return 0;
}


#include<stdio.h>
#define N 1123456
#define M 112233

long long a[10];
long long aa[10];
long long b[10];
int c[M];
int cc[M];
char d[N];
int next[N];
int pre[N];
long long output;
long long temp;

void prime( int n )
{
  int i, o, p, j, k, l;
  for (i = 0;i<=n+10;++i)
  {
    d[i] = 1;
    next[i] = i+1;
    pre[i] = i-1;
  }
  d[0] = 0; d[1] = 0;
  for (i=2;i<=n;i=next[i])
  {
    for (j=next[i];j<=n;j=next[j])
      if (j%i == 0)
      {
        p = pre[j];
        next[p] = next[j];
        pre[next[j]] = p;
        d[j] = 0;
      }
  }
  c[0] = 0;
  for (i=0;i<=n;++i)
    if (d[i] == 1)
    {
      c[++c[0]] = i;
//printf( "p = %d\n", i );
    }
printf( "%d\n", c[0] );
}

int dd(int x )
{
  int p;
  while( x>=10 )
  {
    p = 0;
    while (x>0)
    {
      p += x%10;
      x = x/10;
    }
    x = p;
  }
  return( x );
}

int ddd(long long x )
{
  long long p;
  while( x>=(long long)10 )
  {
    p = 0;
    while (x>0)
    {
      p += x%10;
      x = x/10;
    }
    x = p;
  }
  return( (int)x );
}

void shu_chu( long long k )
{
  int a[100];
  int i, j;
  i = 0;
  if (k==0)
  {
    printf("0\n" );
    return;
  }
  while(k!=0)
  {
    a[i++] = k%10;
    k = k/10;
  }
  while( i>0 ) printf( "%d", a[--i] );
//  printf( "\n" );
}

main()
{
  int i, o, p, j, k, l, n, m, q;
  scanf( "%d", &n );
  if (n==1) {printf( "0\n" ); return 0;}
  prime( n );
  for (i=0;i<10;++i) {a[i] = 0; b[i] = 0;}
  a[1] = 1; b[1] = 1;

  for (i=2;i<=n;++i)
  {
    p = i;
    temp = (long long)1;
    for (j=1;j<=c[0];++j)
    {
      q = 0;
      while( p%c[j] == 0 )
      {
        ++q;
        p /= c[j];
//printf("%d %d\n", p, j );
      }
      ++q;
//if (c[j]==i) cc[j] = 0;
      temp *= (long long)q;
    }
temp -= 2;
//printf(" temp = %d %lld\n", i, temp );
    for (j=0;j<=9;++j) aa[j] = (long long)0;
    for (j=0;j<=9;++j)
    {
      aa[dd(j*i)] += a[j];
    }
    //++a[dd(j)];
    for (j=0;j<=9;++j) output+=(long long)2*a[j]*aa[j]; //2 usual

    output += aa[dd(i)] * (long long)2; //2 special

    output -= (long long)2;

    ++a[dd(i)];

    output += a[ddd((long long)i*(long long)i)]; //3

    output += b[dd(i)] - temp;  //1
    for (j=0;j<=9;++j) b[j] += aa[j] * 2;
    b[ddd((long long)i*(long long)i)] += (long long)1;
  }

//  printf( "%lld\n", output );
  shu_chu( output );
  return 0;
}


    #include<stdio.h>
    #include<string.h>
    #include<conio.h>
    #include<math.h>
    int main()
    {
        int t;
        scanf("%d",&t);
        while(t--)
        {
            long long int n,i,k,j,m,ans,ans1;
            scanf("%lld",&n);
            ans=1;
            ans1=n-1;
            k=sqrt(n);
            for(i=2;i<=k;i++)
            {
                if(n%i==0)
                {
                   ans=n/i;
                   ans1=n-x;
                   break;
                }
            }
            printf("%lld %lld\n",ans,ans1);
        }
        return 0;
    }


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

int main()
{
    int t,x,i,p,q,j,a,b,c,d,f;

    scanf("%d",&t);

    while(t--)
    {
        scanf("%d",&x);

        if(x%2==0)
        {
            printf("%d %d\n",x/2,x/2);

            continue;
        }

        f=0;
        for(i=2;i*i<=x;i++)
        {
            if(x%i==0)
            {
                p=x/i; f=1; break;
            }
        }

        if(f)
        {
            q=x-p;
        }
        else
        {
            p=1; q=x-p;
        }

        printf("%d %d\n",p,q);
    }
}


#include<stdio.h>
int main()
{
  int tests;
  scanf("%d",&tests);
  while(tests--)
   {
    int min_v=1000000009;
    int min_l,min_h;
      int n;
      scanf("%d",&n);
      int l=1,h=n-1;
      while(l<=h)
       {

          if(h%l==0&&min_v>h)
             {
               min_v=high;
               min_l=l;
               min_h=h;
             }
         l++;
         h--;
       }
   printf("%d %d\n",min_l,min_h);
   }
 return 0;
}

int find_min(int i,int j)
{
  return i<j?i:j;
}


#include<stdio.h>
unsigned long long minlcm(unsigned long long int n);

int main()
{
    unsigned long long int  t,n,i;
    scanf("%llu",&t);
    for(i=1 ;i<=t ;i++)
    {
        scanf("%llu",&n);
        minlcm(n);

    }

}
unsigned long long int minlcm(unsigned long long int n)
{  unsigned long long int a,b,c,d,i,min,e,f;
    for(i=1 ;i<=n/2 ;i++)
    {

        a=i;
        b=n-i;
        min=n;
        while(a!=0)
        {
           c=b%a;
           b=a;
           a=c;
        }
        d=(n-i)*i/b;
        if(d<min) { min=d;e=i;f=n-i;}

    }

    printf("%llu %llu\n", e,f);


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

#define ll long long
int GCD(int a,int b){int r; while(a){r=b; b=a; a=r%a;} return b;}

int main(){
  int i,j,k,l,m,n;
  int t1,t2,x1,x2,t0;
  double opt, tmp;
  int r1, r2;
  ll y1, y2, yy1, yy2;

  while(scanf("%d%d%d%d%d",&t1,&t2,&x1,&x2,&t0)==5){
    opt = 1e100;

    if(t1==t0 && t2==t0){
      printf("%d %d\n",x1,x2);
      continue;
    }
    if(t1==t0){
      printf("%d 0\n",x1);
      continue;
    }
    if(t2==t0){
      printf("0 %d\n",x2);
      continue;
    }

    y2 = 1;
    REP(y1,0,x1+1){
      while(t1*y1+t2*y2 < t0*(y1+y2)){
        y2++;
        if(y2 > x2) break;
      }
      if(y2 > x2) break;

      k = GCD(y1, y2);
      if(k>1) continue;

      tmp = (t1*y1+t2*y2) / (double)(y1+y2);
      if(opt > tmp){
        opt = tmp;

        k = 1000000000;
        if(y1 && k > x1 / y1) k = x1 / y1;
        if(y2 && k > x2 / y2) k = x2 / y2;

        r1 = y1 * k;
        r2 = y2 * k;
      }
    }

    printf("%d %d\n",r1,r2);
  }

  return 0;
}


#include<stdio.h>

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

int a[105];

int main()
{
    int n,k;
    while(scanf("%d%d",&n,&k)+1)
    {
        for(int i=0;i<n;i++) scanf("%d",&a[i]);
        int ans=0;
        for(int i=0;i<k;i++)//判别k次
        {
            int cnt=0;
            for(int j=i;j<n;j+=k)
            {
                if(a[j]==1) cnt++;
            }
            ans+=min(cnt,n/k-cnt);        }
        printf("%d\n",ans);
    }
    return 0;
}


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

char Data[101][101];

int main()
{
    int N,K,i,j,k,Ans,AllOne,AllTwo,Min;
    int A[100];
    scanf("%d %d",&N,&K);
    for(i=0; i<N; ++i)
    {
        scanf("%d",&A[i]);
    }
    for(i=0,AllOne=AllTwo=0; i<N; i+=K)
    {
        for(j=i,k=0; j<i+K; ++j,++k)
        {
            Data[i/K].Str[k]=A[j]+'0';
            if(A[j]==1)
            {
                ++AllTwo;
            }
            else
            {
                ++AllOne;
            }
        }
        Data[i/K].Str[k]='\0';
    }
	Min=AllOne;
	if(AllTwo<Min)
	{
		Min=AllTwo;
	}
	for(i=0;i<N/K;++i)
	{
		for(Ans=j=0;j<N/K;++j)
		{
			for(k=0;k<K;++k)
			{
				if(Data[j][k]!=Data[i][k])
				{
					++Ans;
				}
			}
		}
		if(Ans<Min)
		{
			Min=Ans;
		}
	}
	printf("%d\n",Min);
    return 0;
}


#include<stdio.h>
#include<stdlib.h>
int main(){
int k,n,i,j;
int count1,count2,count=0;
int *a;
scanf("%d %d",&n,&k);
a=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<k;i++){
count1=0;
count2=0;
j=i;
while(j<n){
if (a[j]==1) count1++;
else count2++;
j=j+k;}
if (count1>count2) count=count2+count;
else count=count1+count;
 }
 printf("%d",count);

}


#include<stdio.h>
#include<stdlib.h>
int main(){
int k,n,i,j;
int count1,count2,count=0;
int *a;
scanf("%d %d",&n,&k);
a=(int*)malloc(n*sizeof(int));
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n/k;i++){
count1=0;
count2=0;
j=i;
while(j<n){
if (a[j]==1) count1++;
else count2++;
j=j+k;}
if (count1>count2) count=count2+count;
else count=count1+count;
 }
 printf("%d",count);

}


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

int main()
{
    int n, m;

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

    int ans = 0;

    int temp;
    int cnt6, cnt3, slot;
    int top = 0;
    while (n > 0 || m > 0)
    {
        if (n != 0) {
            temp = 2 * n;

            n = 0;
            if (m > 0) {
                cnt3 = (temp-top)/3;
                cnt6 = (temp - top)/6;
                slot =
                //printf("cnt6 : %d\n", cnt6);
                if (m >= cnt3) {
                    //printf("t1\n");
                    n+=cnt6;
                    m-=cnt3;
                    top += cnt3*3;
                } else {
                    //printf("t2\n");
                    n += m;
                    m = 0;
                    top += m*3;
                }
            }
            ans+=temp;
        } else {
            //printf("%d %d %d\n", n, m, top);
            top+=m*3;
            m=0;

        }

    }
    if (top > ans) {
        printf("%d\n", top);
    } else
        printf("%d\n", ans);

    return 0;
}


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


#include<stdio.h>

#define N 101

int set1[100000000]={0};
int set2[100000000]={0};

int main()
{
	int left, right, i, count = 1, check = 0;

	scanf("%d%d", &left, &right);

	for(i = 2; i <= 1e7; i+=2)
		set1[count++] = i;
	count = 1;
	for(i = 3; i <= 1e7; i+=3)
		set2[count++] = i;

	int temp, left_use = 0, right_use = 0;

	if((set1[left]/6) >= (set2[right]/6))
		temp = set2[right]/6;

	else if((set1[left]/6) < (set2[right]/6))
		temp = set1[left]/6;

	for(i = 0; i < temp; i++)
	{
		if(set1[left+1] > set2[right+1])
		{
			right += 1;
			right_use = 1;
		}
		else if(set1[left+1] <= set2[right+1])
		{
			left += 1;
			left_use = 1;
		}
		if((left_use == 1) && (set1[left]%6 == 0))
		{
			if(set2[right] > set1[left])
				temp++;

			left_use = 0;
		}
		else if((right_use == 1) && (set2[right]%6 == 0))
		{
			if(set1[left] > set2[right])
				temp++;

			right_use = 0;
		}
		if(set1[left] == set2[right])
			temp++;
	}
	if(set1[left] > set2[right])
		printf("%d", set1[left]);
	else if(set1[left] < set2[right])
		printf("%d", set2[right]);

    return 0;
}


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


#include <stdio.h>

int main(void){
	int n;
	scanf("%d",&n);
	printf("%d\n",(n+1)/2)
	return 0;
}


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


	#include<stdio.h>
	#include<iostream>
	int main()
	{
 		long long int n,i;
		cin >> n;
		i= n%2 ? n/2+1 : n/2;
		cout << i;
		return 0;
	}


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

    scanf("%d", &n);

    if(n==1)
        printf("%d\n", n);
    else
    {
        n = n/2;
        printf("%d\n", n);
    }

    return 0;

}


#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<limits.h>
char arr[20][20];
int cmp[20];
char numbs[50];
int flag;
int cnt;
int solve(){
int len=strlen(numbs); int i; int k=0;
for(i=0;i<len-1;i++){
int f = arr[numbs[i]-'0'][0]-'0';
int f1= arr[numbs[i]-'0'][1]-'0';
int l = arr[numbs[i+1]-'0'][0]-'0';
int l1 = arr[numbs[i+1]-'0'][1]-'0';

cmp[k++]=l-f;;
cmp[k++]=l1-f1;
}
int x,m;
for(i=0;i<4;i++){
for(x=0;x<3;x++){
flag=1;
if(i==3 && x==0)
continue;
if(i==3 && x==2)
continue;
int t=i;
int t1=x;
for(m=0;m<k;m+=2){
t = t+cmp[m];
t1 = t1+cmp[m+1];
if(t>3 || t<0 || t1>2 || t1<0 || (t==3 && t1==0) || (t==3 && t1==2))
flag=0;;
}
if(flag){
cnt++;
if(cnt==2){
printf("NO");
return;}}
}
}
}
int main(){
int a,b,c,d,e,f,g,h;
strcpy(arr[0],"31");
strcpy(arr[1],"00");
strcpy(arr[2],"01");
strcpy(arr[3],"02");
strcpy(arr[4],"10");
strcpy(arr[5],"11");
strcpy(arr[6],"12");
strcpy(arr[7],"20");
strcpy(arr[8],"21");
strcpy(arr[9],"22");
scanf("%d",&f);
getchar();
gets(numbs);
solve();
if(cnt!=2){
        printf("YES");
}
}


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

int main() {
	int test;
	char inp[11];
	int inp2[11];
	scanf ("%d\n",&test);
	gets(inp);
	memset (inp2, 0, sizeof(inp2));
	int x, check=1;
	for (x=0;x<test;x++){
		int lala = inp[x]-'0';
		inp2[lala]++;

	}

	if (!(inp2[1]>0||inp2[4]>0||inp2[7]>0||inp2[0]>0)) {
		printf ("NO\n");
	}
	else if (!(inp2[3]>0||inp2[6]>0||inp2[9]>0||inp2[0]>0)) {
		printf("NO\n");
	}
	else if (!(inp2[1] > 0 || inp2[2]>0 || inp2[3]>0)) {
		printf("NO\n");
	}
	else if (!(inp2[7] >0 || inp2[0] >0 ||inp2[9]>0)) {
		printf("NO\n");
	}
	else {
		printf("YES\n");
	}
}


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

int main() {
	int test;
	char inp[11];
	int check=0;
	scanf ("%d\n", &test );
	gets(inp);
	for (int x=0;x<test;x++){
		if (inp[x]=='3' || inp[x]=='7')check++;
		if (inp[x]=='9' || inp[x]=='1')check++;
		if (inp[x]=='2' || inp[x]=='0')check++;
	}
	if (check>=2)printf("YES\n");
	else printf("NO\n");
}


#include<stdio.h>

typedef unsigned long long int u_int;

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

}


#include<stdio.h>
#include<math.h>
int lcm(int a,int b)
{
	int i=1;
	while(!(i%a==0 && i%b==0))
		i++;
	return i;
}
int main()
{
	int a,b,max,min;
	scanf("%d%d",&a,&b);
	max=(a>b)?a:b;
	min=(a>b)?b:a;
	int l=lcm(a,b);
	if(fabs(l/min-l/max)>1)
	{
		if(a<b)
			puts("Dasha");
		else
			puts("Masha");
	}
	else
		puts("Equal");
	return 0;
}


#include<stdio.h>

#define ull long long

void swap(ull int* a,ull int* b)
{
	*a=*a+*b;
	*b=*a-*b;
	*a=*a-*b;
}

ull int find_lcm(ull int big,ull int small)
{
	ull int i=0;
	if(big<small)
		swap(&big,&small);
	for(i=big;!(i%big==0 && i%small==0);i++);
	return i;
}

int main()
{
	ull int a,b,M=0,D=0,lcm,left=0,right=0,i=1,j=1;
	scanf("%l64d %l64d",&a,&b);

	lcm=find_lcm(a,b);

	while(right<lcm)
	{
		left=right;
		if(a*i<b*j)
		{
			right=a*i;
			i++;
			D++;
		}
		else
		{
			right=b*j;
			j++;
			M++;
		}

	}
	if(a<b)
		M++;
	else
		D++;

	if(M<D)
		printf("Dasha\n");
	else if(D<M)
		printf("Masha\n");
	else
		printf("Equal\n");
	return 0;

}


#include<stdio.h>

int main()
{
    int a, b;
	scanf("%d %d", &a, &b);
	int d, m;
	d = m = 0;
	int nd, nm;
	nd = a;
	nm = b;
	while( nd != nm)
	{
	    if(nd<nm)
	    {
	        d++;
	        nd += a;
	    }
	    else
	    {
	        m++;
	        nm += b;
	    }
	}
	if(nd == nm)
	{
	    if(a<b)
	        m++;
	    else
	        d++;
	}
	if(d==m)
	    printf("Equal\n");
	else if(d>m)
	    printf("Dasha\n");
	else
	    printf("Masha\n");
	return 0;
}


#include<stdio.h>
int main()
{
	int a[13];
	for(i=2;i<11;i++)
		a[i]=4;
	for(i=)
	scanf("")
}


#include<stdio.h>
main()
{
    unsigned long long int n,a,b,a1,b1,area,requ,q,flag=0,x,y;
    scanf("%lld %lld %lld",&n,&a,&b);
    q=a;
    area=a*b;
    requ=(6*n);
    if(area>=requ)
    {
        printf("%lld\n",area);
        printf("%lld %lld",a,b);

    }
    else
    {
        if((requ%a)==0)
        {
            a1=a;
            b1=(requ/a);
            x=b1;
            y=a1;
       }
       else if(requ%b==0)
       {
           b1=b;
           a1=requ/b;
           x=b1;y=a1;
       }
        else
        {

            while(1)
            {
                a++;
                if((requ%a)==0)
                {
                    a1=a;
                    b1=requ/a;
                    if(b1<b)
                    {
                        a1=q;
                        b1=b;
                        flag=1;
                        break;
                    }
                    x=b1;
                    y=a1;
                    break;

                }
            }
            if(flag==1)
            {
                if(a1==b1)
                {
                    y=a1;
                    x=b1;

                }
                if(a1>b1)
                {
                    y=a1;
                    x=b1;
                }
                if(a1<b1)
                {
                    y=b1;
                    x=a1;
                }

                while(1)
                {
                    y++;
                    if((y*x)>=requ)
                        break;
                }

            }

        }

         printf("%lld\n",(x*y));
        printf("%lld %lld",y,x);

        }
        return 0;

}


#include<stdio.h>
main()
{
    unsigned long long int n,a,b,a1,b1,area,requ,flag=0,x,y;
    scanf("%lld %lld %lld",&n,&a,&b);
    x=a;
    y=b;
    area=a*b;

    requ=(6*n);
    if(area>=requ)
    {
        printf("%lld\n",area);
        printf("%lld %lld",a,b);

    }
    else
    {
        if((requ%x)==0)
        {
            a1=x;
            b1=(requ/x);
        }
       else if((requ%y)==0)
       {
           b1=y;
           a1=requ/y;
        }
        else
        {

            while(1)
            {
                x++;

                if((requ/x)<y)
                    {flag=1;
                    x=a;
                    break;}
                if((requ%x)==0)
                {
                    a1=x;
                    b1=requ/x;
                    break;
                }
            }

            if(flag==1)
            {

                requ++;

                while(1)
                {

                    x++;
                    if((requ/x)<y)
                    {
                        requ++;
                        x=a;
                        continue;
                    }

                    if(requ%x==0)
                {
                    a1=x;
                    b1=(requ/x);
                    break;

                }

            }

        }

        }

         printf("%lld\n",(a1*b1));
        printf("%lld %lld",a1,b1);

        }
        return 0;

}


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

int main()
{
    long long n, a, b, s, tmps, tmpa, tmpb, tmp;
    scanf("%I64d %I64d %I64d", &n, &a, &b);
    s = 1000000000000;
    if (a > b)
    {
        tmp = a; a = b; b = tmp;
    }
    tmpb = b; tmpa = a;
    if (a*b < 6 * n)
    {
        while (tmpa <= sqrt(float(6.0*n))+1)
        {
            tmpb = ceil(6.0*n / tmpa);
            tmps = tmpa*tmpb;
            if (tmps < s&& tmps >=6*n)
            {
                s = tmps;
                a = tmpa;
                b = tmpb;
            }
            tmpa++;
        }
    }
    else s = a*b;
    printf("%I64d\n%I64d %I64d", s, a, b);

    return 0;
}


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

int main(){
        long long n,a,b,temp;
        scanf("%I64d%I64d%I64d",&n,&a,&b);
        long long area=6*n,raiz,area1=1000000000000000000;
        if(area<=a*b) printf("%I64d\n%I64d %I64d\n",a*b,a,b);
        else{
        int ind=0;
        if(a>b) temp=a, a=b, b=temp, ind=1;
        raiz=(long long)sqrt(6*n);
        long long i,j,ans1,ans2;
        for(i=1;i<=raiz+1;i++){
                if(i>=a){
                j=(6*n+i-1)/i;
                j=max(j,b);
                        if(i*j>=6*n && area1 > i*j ){
                        area1=i*j;
                        ans1=i;
                        ans2=j;
                        }
                }
        }
        if(ind)
        printf("%I64d\n%I64d %I64d\n",area1,ans2,ans1);
        else
        printf("%I64d\n%I64d %I64d\n",area1,ans1,ans2);
        }
        return(0);
}


#include<stdio.h>
int main() {
	int t; scanf("%d", &t);
	int mod = 1e9 + 7;
	while (t--) {
		int n, k; scanf("%d%d", &n, &k);
		long long ans = 1;
		for (int i = 0; i < k; i++) {
			ans *= n;
			ans %= mod;
		}
		printf("%lld\n", ans);
	}
}


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

const unsigned long long int mod=1000000007;

void solve() {

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

unsigned long long int r=1;

for(int i=0; i<k; i++) {
    r=(r*n)%mod;
}
printf("%lld\n",r);

}

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

    for(int i=0; i<t; i++) {
        solve();
    }
    return 0;
}


#include <stdio.h>
#define forin(i, n) for (i = 0; i < n; i++)
#define lli long long int
#define printSp(i, a, n) forin(i, n) printf('%d ', a[i]);
#define printLn(i, a, n) forin(i, n) printf('%d\n', a[i]);
#define fis(n) fast_int_scan(n)
#define fls(n) fast_long_scan(n)
#define flli(n) fast_lli_scan(n)
#define scanIA(i, a, n) forin(i, n) fis(a + i);
#define scanLA(i, a, n) forin(i, n) fls(a + i);
#define scanLLIA(i, a, n) forin(i, n) flli(a + i);

void fast_int_scan(int *number)
{
    //variable to indicate sign of input number
    int negative = 0;
    register int c;

    *number = 0;

    // extract current character from buffer
    c = getchar();
    if (c == '-')
    {
        // number is negative
        negative = 1;

        // extract the next character from the buffer
        c = getchar();
    }

    // Keep on extracting characters if they are integers
    // i.e ASCII Value lies from '0'(48) to '9' (57)
    for (; (c > 47 && c < 58); c = getchar())
        (*number) = (*number) * 10 + c - 48;

    // if scanned input has a negative sign, negate the value
    if (negative)
        (*number) *= -1;
}

void fast_lli_scan(lli *number)
{
    //variable to indicate sign of input number
    int negative = 0;
    register int c;

    *number = 0;

    // extract current character from buffer
    c = getchar();
    if (c == '-')
    {
        // number is negative
        negative = 1;

        // extract the next character from the buffer
        c = getchar();
    }

    // Keep on extracting characters if they are integers
    // i.e ASCII Value lies from '0'(48) to '9' (57)
    for (; (c > 47 && c < 58); c = getchar())
        (*number) = (*number) * 10 + c - 48;

    // if scanned input has a negative sign, negate the value
    if (negative)
        (*number) *= -1;
}

int main(void)
{
	int T;
	fast_int_scan(&T);
	while (T--)
	{
		lli n, k, i, sum = 1;
		fast_lli_scan(&n);
        fast_lli_scan(&k);
		for(i=1; i<=k; i++)
		{
			sum *= n;
			sum %= 1000000007;
		}

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


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

 while(t--){
  int n,k;
  int max=1e10+7;
  scanf("%d%d",&n,&k);
  long long int ans=1;
  for(int i=1;i<=n;i++){
   ans=(ans*i)%max;
  }
  printf("%lld",ans)
 }
 return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k,i,T;
    long long ans=1LL;
    long long mod=(1E9)+7;
    scanf("%d",&T);
    while(T--)
    {
        ans=1LL;
    scanf("%d%d",&n,&k);
    for(i=0;i<k;i++)
    {
        ans=(ans*n)%mod;
    }
    printf("%lld\n",ans);
     }
}


#include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <string>

using namespace std;

int main(){
	long int n;
	cin >> n ;
	cout << (12 * n * (n-1) + 2)/2 << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int iIn1,iIn2,iIn3,iIn4;
int main()
{
    cin>>iIn1>>iIn2>>iIn3>>iIn4;
    cout<<(((iIn1^iIn2)&(iIn3|iIn4))^((iIn2&iIn3)|(iIn1^iIn4)));
    return 0;
}


main()
{
int n;
scanf("%d",&n);
printf("%d",6*n*(n−1)+1);
return 0;
}


#include<stdio.h>
int main(void){
    int iIn1,iIn2,iIn3,iIn4;
    scanf("%d %d %d %d",&iIn1,&iIn2,&iIn3,&iIn4);
    printf("%d", ((iIn
    1^iIn2) & (iIn3 | iIn4
    )) ^ ((iIn2&iIn3) | (iIn1^iIn4)));
}


#include <stdio.h>

#define INF (1LL << 60)

struct point
{
    int x;
    int y;
};

struct point p[4][2];
int q[4];
double g[4];

int check(struct point p1, struct point p2)
{
    if (p1.x == p2.x && p1.y == p2.y)
    {
        return 1;
    }
    return 0;
}

void solve()
{
    int i, j, k, t, f;
    for (i = 0; i < 4; i ++)
    {
        if (check(p[i][0], p[i][1]))
        {
            printf("NO\n");
            return;
        }
        k = t = 0;
        for (j = 0; j < 4; j ++)
        {
            f = 0;
            if (j == i)
            {
                continue;
            }
            if (check(p[i][0], p[j][0]))
            {
                k ++;
                f = 1;
            }
            if (check(p[i][0], p[j][1]))
            {
                k ++;
                f = 1;
            }
            if (k > 1)
            {
                printf("NO\n");
                return;
            }
            if (check(p[i][1], p[j][0]))
            {
                t ++;
                f = 1;
            }
            if (check(p[i][1], p[j][1]))
            {
                t ++;
                f = 1;
            }
            if (t > 1)
            {
                printf("NO\n");
                return;
            }
            if (f == 0)
            {
                q[i] = j;
            }
        }
        if (k != 1 || t != 1)
        {
            printf("NO\n");
            return;
        }
        if (p[i][0].x == p[i][1].x)
        {
            g[i] = INF;
        }
        else
        {
            g[i] = (double)(p[i][1].y - p[i][0].y) / (p[i][1].x - p[i][0].x);
        }
    }
    for (i = 1; i < 4; i ++)
    {
        if (g[i] != g[0])
        {
            break;
        }
    }
    if (i == 4)
    {
        printf("NO\n");
        return;
    }
    for (i = 0; i < 4; i ++)
    {
        if (g[i] != g[q[i]])
        {
            printf("NO\n");
            return;
        }
    }
    printf("YES\n");
}

int main()
{
    int i;
    for (i = 0; i < 4; i ++)
    {
        scanf("%d%d%d%d", &p[i][0].x, &p[i][0].y, &p[i][1].x, &p[i][1].y);
    }
    solve();
    return 0;
}


#include <stdio.h>

#define INF (1LL << 60)
#define EPS (1e-7)

struct point
{
    int x;
    int y;
};

struct point p[4][2];
int q[4];
double g[4];

int check(struct point p1, struct point p2)
{
    if (p1.x == p2.x && p1.y == p2.y)
    {
        return 1;
    }
    return 0;
}

int judge(double value)
{
    if (value > -1.0)
    {
        if (value + 1.0 < EPS)
        {
            return 1;
        }
        return 0;
    }
    if (-1.0 - value < EPS)
    {
        return 1;
    }
    return 0;
}

void solve()
{
    int i, j, k, t, f;
    for (i = 0; i < 4; i ++)
    {
        if (check(p[i][0], p[i][1]))
        {
            printf("NO\n");
            return;
        }
        k = t = 0;
        for (j = 0; j < 4; j ++)
        {
            f = 0;
            if (j == i)
            {
                continue;
            }
            if (check(p[i][0], p[j][0]))
            {
                k ++;
                f = 1;
            }
            if (check(p[i][0], p[j][1]))
            {
                k ++;
                f = 1;
            }
            if (k > 1)
            {
                printf("NO\n");
                return;
            }
            if (check(p[i][1], p[j][0]))
            {
                t ++;
                f = 1;
            }
            if (check(p[i][1], p[j][1]))
            {
                t ++;
                f = 1;
            }
            if (t > 1)
            {
                printf("NO\n");
                return;
            }
            if (f == 0)
            {
                q[i] = j;
            }
        }
        if (k != 1 || t != 1)
        {
            printf("NO\n");
            return;
        }
        if (p[i][0].x == p[i][1].x)
        {
            g[i] = INF;
        }
        else
        {
            g[i] = (double)(p[i][1].y - p[i][0].y) / (p[i][1].x - p[i][0].x);
        }
    }
    for (i = 1; i < 4; i ++)
    {
        if (g[i] != g[0])
        {
            break;
        }
    }
    if (i == 4)
    {
        printf("NO\n");
        return;
    }
    for (i = 0; i < 4; i ++)
    {
        if (g[i] != g[q[i]])
        {
            printf("NO\n");
            return;
        }
        for (j = i + 1; j < 4; j ++)
        {
            if (j != q[i])
            {
                if (g[i] == INF)
                {
                    if (g[j] != 0)
                    {
                        printf("NO\n");
                        return;
                    }
                }
                else if (g[i] == 0)
                {
                    if (g[j] != INF)
                    {
                        printf("NO\n");
                        return;
                    }
                }
                else
                {
                    if (g[j] == INF || judge(g[i] * g[j]) == 0)
                    {
                        printf("NO\n");
                        return;
                    }
                }
            }
        }
    }
    printf("YES\n");
}

int main()
{
    int i;
    for (i = 0; i < 4; i ++)
    {
        scanf("%d%d%d%d", &p[i][0].x, &p[i][0].y, &p[i][1].x, &p[i][1].y);
    }
    solve();
    return 0;
}


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

int main()
{
    int a,i,j,k;
    long long temp[4][4];
    long long tmp;
    long long verticalLines[4][4];
    long long horizontalLines[4][4];
    long long test1,test2;
    int flag=0;
    int verticalfound=0;
    int horizontalfound=0;

    for(i=0; i<4; i++)
    {
        for(j=0; j<4; j++)
        {
            scanf("%lld",&temp[i][j]);
        }
    }

    //CHECKING VERTICAL AND HORIZONTAL LINES
    j=0;
    k=0;
    for(i=0; i<4 && !flag; i++)
    {
        if(temp[i][0]==temp[i][2] && temp[i][1]!=temp[i][3]) //VERTICAL LINE
        {
            for(a=0;a<4;a++)
            {
                verticalLines[j][a]=temp[i][a];
            }

            if(verticalLines[j][1]>verticalLines[j][3])
            {
                tmp=verticalLines[j][1];
                verticalLines[j][1]=verticalLines[j][3];
                verticalLines[j][3]=tmp;
            }

            j++;

            if(j==1)
            {
                if(verticalLines[0][0]==verticalLines[1][0])
                {
                    flag=1;
                }
            }

            if(j>2)
            {
                flag=1;
            }

        }
        else if(temp[i][1]==temp[i][3] && temp[i][0]!=temp[i][2]) //HORIZONTAL LINE
        {
            for(a=0;a<4;a++)
            {
                horizontalLines[k][a]=temp[i][a];
            }

            if(horizontalLines[k][0]>horizontalLines[k][2])
            {
                tmp=horizontalLines[k][0];
                horizontalLines[k][0]=horizontalLines[k][2];
                horizontalLines[k][2]=tmp;
            }

            if(k==1)
            {
                if(horizontalLines[0][1]==horizontalLines[1][1])
                {
                    flag=1;
                }
            }

            k++;
            if(k>2)
            {
                flag=1;
            }
        }
        else
        {
            flag=1;
        }
    }

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

    //CHECKING INTERSECTION
    //VERTICAL LINES
    if( (verticalLines[0][1]==verticalLines[1][1]) && (verticalLines[0][3]==verticalLines[1][3]))
    {
       verticalfound=1;
    }

    //HORIZONRAL LINES
    if(horizontalLines[0][0]==horizontalLines[1][0] && horizontalLines[0][2]==horizontalLines[1][2])
    {
        horizontalfound=1;
    }

    if ( !(verticalfound==1 && horizontalfound==1) )
    {
        printf("NO");
        return 0;
    }

    //POSITIVE AREA
    if(!((verticalLines[0][0]>0 || verticalLines[1][0]>0) && (horizontalLines[0][1]>0 || horizontalLines[1][1]>0)))
    {
        printf("NO");

    }
    else
    {
        printf("YES");
    }

    return 0;
}


#include<stdio.h>
int main()
{
    int n,h,m,i,j,num,ans=0;
    scanf("%d%d%d",&n,&h,&m);
    int l[n],r[n],x[n],a[n];
    for(i=0; i<m; i++)
        scanf("%d %d %d",&l[i],&r[i],&x[i]);
    for(i=1; i<=n; i++)
    {
        num=h;
        for(j=0; j<m; j++)
        {
            if(i>=l[j] && i<=r[j])
                    num=x[j];
        }
        ans=ans+(num*num);
    }
    printf("%d\n",ans);
    return 0;
}


//https://codeforces.com/problemset/problem/1162/A
/*
Опять ограничения
ограничение по времени на тест
1 секунда
ограничение по памяти на тест
256 мегабайт
ввод
стандартный ввод
вывод
стандартный вывод

Вы планируете строить дома на улице. На улице есть n
мест, где вы можете построить дома. Эти места пронумерованы слева направо от 1 до n. В каждом месте вы можете построить дом с целочисленной высотой от 0 до h

.

В каждом месте, если дом имеет высоту a
, вы получите от него прибыль в размере a2

долларов.

Город имеет m
ограничений. В соответствии с i-м ограничением, самый высокий дом от li до ri (включительно) должен иметь высоту не более xi

.

Вы хотели бы построить дома, чтобы максимизировать свою прибыль. Определите максимально возможную прибыль.
Входные данные

Первая строка содержит три целых числа n
, h и m (1≤n,h,m≤50

) — количество мест, максимальная высота и количество ограничений.

Каждая из следующих m
содержит три целых числа li, ri и xi (1≤li≤ri≤n, 0≤xi≤h) — левая и правая граница (включительно) i

-го ограничения и максимальная возможная высота на этом отрезке.
Выходные данные

Выведите одно целое число — максимальную возможную прибыль.
Примеры
Входные данные
Скопировать

3 3 3
1 1 1
2 2 3
3 3 2

Выходные данные
Скопировать

14

Входные данные
Скопировать

4 10 2
2 3 8
3 4 7

Выходные данные
Скопировать

262

Примечание

В первом примере можно построить 3
дома, максимальная высота которых — 3, а также есть 3 ограничения. Первое ограничение говорит, что самый высокий дом между 1 и 1 должен иметь высоту не более 1. Второе ограничение говорит, что самый высокий дом между 2 и 2 должен иметь высоту не более 3. Третье ограничение говорит, что самый высокий дом между 3 и 3 должен иметь высоту не более 2

.

В этом случае оптимально строить дома высотой [1,3,2]
. Это вписывается во все ограничения. Общая прибыль в этом случае составляет 12+32+22=14

.

Во втором примере можно построить 4
дома, максимальная высота которых — 10, а также есть 2 ограничения. Первое ограничение говорит, что самый высокий дом от 2 до 3 должен иметь высоту не более 8. Второе ограничение говорит, что самый высокий дом от 3 до 4 должен иметь высоту не более 7

.

В этом случае оптимально строить дома высотой [10,8,7,7]
. Мы получаем прибыль в размере 102+82+72+72=262. Обратите внимание, что есть два ограничения на дом 3, и оба они должны выполняться. Кроме того, обратите внимание, что хотя нет никаких явных ограничений на дом 1, мы все равно должны ограничить его высоту не более 10 (h=10).
*/
#include <stdio.h>
#include <stdlib.h>
const int MAX = 51;

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

int main (){
int i,h,n,m;
int a[MAX];
scanf("%i%i%i",&n,&h,&m);
for(i=0;i<MAX;i++)
	a[i] = h;
for (i=0;i<m;i++){
	int l,r,x;
	scanf("%i%i%i",&l,&r,&x);
	int j;
	for(j=l-1;j<=r-1;j++)
		a[j] = x;

	//a[l-1] = min ( a[l-1], -x) ;
	//a[r-1] = +x;

}
m = 0;
for (i=0;i<n;i++)
	m += a[i]*a[i];

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


#include<stdio.h>
int main()
{
    int n,h,m,i,j,ans=0;
    scanf("%d%d%d",&n,&h,&m);
    int l[n],r[n],x[n],a[n];
    for(i=0; i<m; i++)
        scanf("%d %d %d",&l[i],&r[i],&x[i]);
    for(i=1; i<=n; i=i+1)
    {
        int num=h;
        for(j=0; j<m; j=j+1)
        {
            if(i>=l[j] && i<=r[j])
            {
                if(num>x[j])
                    num=x[j];
            }
        }
        ans=ans+(num*num);
    }
    printf("%d\n",ans);
    return 0;
}


#include<stdio.h>
int main(){
    int n,h,m,i,maxprof=0,j,b,c;
    scanf("%d%d%d",&n,&h,&m);
    int a[n];
    int l[m],r[m],x[m];
    for(i=0;i<m;i++){
        scanf("%d%d%d",&l[i],&r[i],&x[i]);
    }
    //initializing array "a"
    for(i=0;i<n;i++){
        a[i]=h;
    }
    for(i=0;i<n;i++){
       b=l[i]-1;
       c=r[i]-1;
       for(j=b;j<=c;j++){
           if(x[i]<=a[j]){
               a[j]=x[i];
           }
       }
    }
    for(i=0;i<n;i++){
        maxprof=maxprof+a[i]*a[i];
    }
    printf("%d",maxprof);

return 0;
}


#include <stdio.h>
#include <string.h>
#define mian main
#define MAXN 103
#define INF 0x3f3f3f3f
#define MIN(a,b) ((a)<(b)?(a):(b))
int read () {
    int x = 0; char ch = getchar();
    while (ch < '0' || ch > '9') ch = getchar();
    while (ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}\
    return x;
}
int vis[MAXN], a[MAXN], b[MAXN], len;
int mian (void) {
    int n = read(), m = read();
    int i, l[2];
    l[0] = read();
    for (i = 1; i < m; ++i) {
        l[i % 2] = read();
        int t = (l[i%2] - l[(i+1)%2] + n) % n;
        if (t == 0) t = n;
        if ((vis[t] || a[l[(i+1)%2]]) && a[l[(i+1)%2]] != t) {
            printf("-1\n");
            return 0;
        }
        vis[t] = 1;
        a[l[(i+1)%2]] = t;
    }
    for (i = 1; i <= n; ++i) {
        if (!vis[i]) b[len++] = i, vis[i] = 1;
    }
    for (i = 1; i <= n; ++i) {
        if (a[i] == 0)
            a[i] = b[--len];
        printf("%d ", a[i]);
    }
    return 0;
}


#include <stdio.h>

int seq[101], num[101], included[101];

int main(void)
{
	int a, b, n, m, f = 0;
	scanf("%d %d", &n, &m);
	for (a = 1; a <= m; a = a + 1)
	{
		int cmp;
		scanf("%d", &seq[a]);
		if (a - 1)
		{
			cmp = seq[a] - seq[a - 1];
			if (cmp > 0)
			{
				if (included[cmp] && num[seq[a - 1]] == 0 || (num[seq[a - 1]] && num[seq[a - 1]] != cmp))
				{
					puts("-1");
					f = 1;
					break;
				}
				included[cmp] = 1;
				num[seq[a - 1]] = cmp;
			}
			else if (cmp <= 0)
			{
				cmp = n + cmp;
				if ((included[cmp] && num[seq[a - 1]] == 0) || (num[seq[a-1]] && num[seq[a-1]] != cmp))
				{
					puts("-1");
					f = 1;
					break;
				}
				included[cmp] = 1;
				num[seq[a - 1]] = cmp;
			}
		}
	}
	for (a = 1; a <= n; a = a + 1)
	{
		if (num[a] == 0)
		{
			for (b = 1; b <= n; b = b + 1)
			{
				if (!included[b])
				{
					num[a] = b;
					included[b] = 1;
					break;
				}
			}
			if (num[a] == 0)
			{
				f = 1;
				puts("-1");
				break;
			}
		}
	}
	if (f == 0)
	{
		for (a = 1; a <= n; a = a + 1)
			printf("%d ", num[a]);
	}
	return 0;
}


#include"stdio.h"
#include"string.h"
#include"math.h"
#include"stdlib.h"
#include"ctype.h"
#include"limits.h"
#include"time.h"

int main()
{
	clock_t lnh=clock();
	int n,m,x=1,c;
	scanf("%d%d",&n,&m);
	int a[100]={0},d[100]={0},ac[100]={0},i,j,l[m];
	for(i=0;i<m;scanf("%d",&l[i++]));

	for(i=0;i<m-1;i++)
	{
		c=l[i+1]-l[i]+n*(l[i]>=l[i+1]);
		d[c-1]=1;
		if(a[l[i]-1]!=c && a[l[i]-1])
		x=0;
		else
		a[l[i]-1]=c;
	}

	for(i=j=0;i<n;i++)
	if(!a[i])
	{
		for(;d[j] && j<n;j++);
		if(j==n)
		break;
		a[i]=++j;
	}

	for(i=0;i<n;i++)
	if(a[i])
	ac[a[i]-1]++;

	for(i=0;i<n;i++)
	if(!a[i] || ac[i]>1)
	x=0;
	if(!x)
	printf("-1");
	else
	{
		for(i=0;i<n-1;i++)
		printf("%d ",a[i]);
		printf("%d",a[i]);
	}
	printf("\n");

	clock_t cls=clock();	//printf("%fms\n",(double)((cls-lnh)*1000)/CLOCKS_PER_SEC);
	return 0;
}


#include<stdio.h>
int ans[104],indx[104],vec[104],y[104];
int main()
{
	int n,m,l[103],i,flag=0,k=0,count=0,p=0,temp;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++)
		scanf("%d",&l[i]);
	for(i=0;i<m-1;i++)
	{
		temp=l[i+1]-l[i];
		if(temp<=0)
			temp=temp+n;
		if(indx[temp]==1 && y[temp]!=l[i])
		{
			flag=1;
			break;
		}
		ans[l[i]]=temp;
		indx[temp]=1;
		y[temp]=l[i];
	}
	for(i=1;i<=n;i++)
	{
		if(indx[i]==0)
		{
			vec[k]=i;
			k++;
		}
		if(ans[i]==0)
			count++;
	}
	if(count!=k || flag==1)
		printf("-1\n");
	else
	{
		for(i=1;i<=n;i++)
		{
			if(ans[i]==0)
			{
				ans[i]=vec[p];
				p++;
			}
			printf("%d ",ans[i]);
		}
		printf("\n");
	}
	return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define min(a,b) (a < b ? a : b)
typedef long long ll;
ll n, m, a[100000], l[200], vis[200], vist[200];

bool solve(){
	ll i, j;
	for(i = 1; i < m; i++){
		if(l[i + 1] > l[i]){
			if(a[l[i]] && a[l[i]] != l[i + 1] - l[i]) return false;
			a[l[i]] = l[i + 1] - l[i];
		}
		else if(l[i + 1] == l[i]){
			if(a[l[i]] && a[l[i]] != n) return false;
			a[l[i]] = n;

			for(j = 1; j <= n; j++)	if(a[j]) vis[a[j]] = 1;
			for(j = 1; j <= n; j++){
				if(!a[j]){
					for(ll k = 1; k <= n; k++){
						if(!vis[k]){
							a[j] = k;
							vis[k] = 1;
							break;
						}
					}
				}
			}// 1 2 3 4 5
			break;
		}
		else{
			if(a[l[i]] && a[l[i]] != n - l[i] + l[i + 1]) return false;
			a[l[i]] = n - l[i] + l[i + 1];
			//vist[a[l[i]]] = l[i];
		}
	}

	//check:
	for(i = 1; i <= n; i++) if(!a[i]) return false;
	for(i = 1; i <= n; i++)
		for(j = 1; j <= n; j++) if(i != j && a[j] == a[i]) return false;
	for(i = 1;)
	return true;
}

int main(void){
	ll i, j, k;
	scanf("%lld%lld", &n, &m);
	for(i = 1; i <= m ; i++) scanf("%lld", l + i);
	if (solve()) for(i = 1; i <= n; i++) printf("%lld ", a[i]);
	else puts("-1\n");
	return 0;
}


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


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


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


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


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


#include <stdio.h>
#include <stdlib.h>
#include<math.h>
int beu(int a)
{
    int k=0,i,q;
    int b=a;
    while (a>0)
    {
        if (a%2==0) k++;
        else break;
        a/=2;
    }
    q=b/(pow(2,k));
    if (q==(pow(2,k+1)-1)) return 1;
    else return 0;
}
int main()
{
    int n,i;
    scanf("%d" ,&n);
    for (i=n;i>0;i++)
    {
        if (n%i==0 && beu(i)==1)
        {printf("%d" ,i);
        break;}
    }
    return 0;
}


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

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

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

int main()
{
	int i,n,a[105],j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}
	if(a[0]==3)
	{
		printf("NO\n");
		return 0;
	}
	int k,l=0,val=1;
	int count[4]={0};
	count[a[0]]=1;
	count[3]=1;
	for(i=1;i<n;i++)
	{
		for(j=1;j<=3;j++)
		{
			if(count[j]==0)
			{
				if(a[i]==j)
				{
					val=0;
					break;
				}
				else
				{
					k=j;
				}
			}
			else
			{
				if(a[i]!=j)
				{
					l=j;
				}
			}
		}
		if(val!=0)
		{
			count[l]=0;
			count[k]=1;
		}
	}
	if(val==0)
		printf("NO\n");
	else
		printf("YES\n");
	return 0;
}


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


	int num, largenum,i;
	scanf("%d",&num);
	for(int i=1;i<num;i++){
		int find = (pow(2,i)-1) * pow(2,i-1);
		if(find<num){
			if(num%num==0){
				largenum=find;
			}
		}else{
			break;
		}
	}
	printf("%d",largenum);


#include <stdio.h>
#include <stdlib.h>
#include<math.h>
long long uocdep(int n) {
	int beauty;
	if (n % 2 != 0) return 1;
	int chantren = floor(((log(n) + log(2))*1.0) / (2 * log(2)))+1;
	for (int i = chantren; i >= 0; i--) {
		beauty = (pow(2, i) - 1)*pow(2, i - 1);
		if (n%beauty == 0) return beauty;
	}
}
int main() {
	int n;
	scanf_s("%d", &n);
	long long dapan = uocdep(n);
	printf("%I64d", dapan);
	return 0;
}


#include<stdio.h>
int main()
{
    long long k;
    scanf("%lld",&k);
    char c[10]="s";
    char s[15]="codeforces";
    k=k-1;
    printf("%s",s);
    while(k--)
    {
        printf("%c",'s');
    }
    printf("\n");
}


#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
    long long k,a;
    int i,j,t=0;
    scanf("%llu",&k);
    int q[10];
    char p[11]="codeforces";
    int put=0;
    for(i=0;i<10;i++)
    {
        q[i]=1;
    }
    while(1)
    {
        a=1;
        for(i=0;i<10;i++)
        {
            a*=q[i];
        }
        if(a>=k)
        {
            break;
        }
        q[a]++;
        a++;
    }
    for(i=0;i<10;i++)
    {
        for(j=0;j<q[i];j++)
        {
            printf("%c",p[i]);
        }
    }
}


#include<stdio.h>
int main(void)
{
	unsigned long long k; //k的个数是2的16次方
	unsigned long long asn;
	scanf_s("%llu", &k);
	char s[10] = "codeforces";
	char q[11]; // 储存codeforces每个字符的重复次数
	//每个字符至少要重复出现一次
	int ten = 0;
	for (int i = 0; i < 10; i++)
		q[i] = 1;
	while (1)
	{
		asn = 1;
		for (int i = 0; i < 10; i++)
			asn = asn * q[i];
		if (asn >= k)
			break;
		if (ten == 10)
			ten = 0;
		q[ten]++;
		ten++;
	}
	for (int i = 0; i < 10; i++)
		for (int j = 0; j < q[i]; j++)
			printf("%c", s[i]);
	return 0;
}


#include<stdio.h>

int main()
{
    long long int n;
    scanf("%lld",&n);
    int a[10];
    for(int i=0;i<10;i++)
      a[i]=1;
    char substr[11]="codeforces";
    int k=1;
    long long int p=0;
    while(k<n)
    {
        k/a[p%10];
        a[p%10]++;
        k*=a[p%10];
        p++

    }
    for(int i=0;i<10;i++)
      for(int j=0;j<a[i];j++)
        printf("%c",substr[i]);
    return 0;
}


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

int main()
{
	long long int k,i,j,a,b,l,flag=0;
	scanf("%lld",&k);
	char arr[15] ="codeforces";
	// for(i=0;i<10;i++)
	// {
	// 	printf("%c-%lld\n",arr[i],i);
	// }
	a=1,b=2;
	while(1)
	{
		for(i=0;i<=10;i++)
		{
			if(long long int(pow(b,i)*pow(a,10-i))>=k)
			{
				flag=1;
				break;
			}
		}
		if(flag==1)
		{
			break;
		}
		a++;
		b++;
	}
	for(j=1;j<=i;j++)
	{
		for(l=1;l<=b;l++)
		{
			printf("%c",arr[j-1]);
		}
	}
	for(j=i+1;j<=10;j++)
	{
		for(l=1;l<=a;l++)
		{
			printf("%c",arr[j-1]);
		}
	}
	printf("\n");
}