#include<stdio.h>
int main()
{
	int l,r,a,i,j,x;
	scanf("%d%d%d",&l,&r,&a);
	for(i=a;i>=0;i--)
	{
		if(l-r>=0)
		{
			x=r+i;
			if(x==l)
			{      if((a-i)%2==0)
				{	printf("%d",2*l+a-i);}
				else{printf("%d",2*l+a-i-1);
				}
			break;
			}
			else if(l>x)
			{
				printf("%d",2*(r+a));
				break;
			}
		}
		else
		{
			x=l+i;
			if(x==r)
			{      if((a-i)%2==0)
				{	printf("%d",2*r+a-i);}
				else{printf("%d",2*r+a-i-1);
				}	break;
			}
			else if(r>x)
			{
				printf("%d",2*(l+a));
					break;
			}
		}
	}
	return 0;
}

#include<stdio.h>
int main(){
    int a,b,c,t,r;
    scanf("%d%d%d",&a,&b,&c);
    if(a+c==0||b+c==0){
        r=0;
    }
    else{
    if(b>a){
       t=a;
       a=b;
       b=t;
    }
    again:
    if(a==b){
        r=2*(a+c/2);
    }
    else if(b+c<=a){
        r=2*(b+c);
    }
    else{

        c=c-a+b;
        b=a;
        goto again;
    }
    }
    printf("%d",r);

    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main ()
{
    int l,r,a,count;
    scanf("%d %d %d",&l,&r,&a);
    int difference= abs(l-r);

    if (l==r)
    {
        count=2*l+a;

        if (count &1!=0)
            --count;
    }
    else if ( l<r)
    {
            if (difference>=a)
                {
                    l=l+a;
                    count=l+l;
                }
            else
            {
                a=a-difference;
                if (a&1!=0)
                    --a;
                count =r+r+a;
            }

    }
        else if (r<l)
            {
                if (difference>=a)
                {
                    r=r+a;
                    count=r+r;
                }
            else
            {
            a=a-difference;
            if (a&1!=0)
                --a;

            count =l+l+a;
            }
            }

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

#include<stdio.h>
#include<conio.h>
main()
{
int l,r,a,temp,ans;
scanf("%d %d %d",&l,&r,&a);
if(l<r)
{  while(a>0)
  {
      l=l+1;
      a=a-1;
  }
  if(l<=r)
  ans=2*l;
  else
  {temp=l-r;
   if(temp%2==0)
   ans=l+r;
   else
   ans=l+r-1;
  }
}
else
{
  while(a>0)
  {
      r=r+1;
      a=a-1;
  }
   if(l>=r)
  ans=2*r;
  else
  {temp=r-l;
   if(temp%2==0)
   ans=l+r;
   else
   ans=l+r-1;
}}
printf("%d",ans);
}

#include<stdio.h>
int main()
{
    int n,i,j,a,b,c,x;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b)
    {
        i=c/2;
        a=a+i;
        b=b+i;
        x=a+b;
    }
    else if(a>b && a-b<=c)
    {
       while(b!=a)
       {
           b=b+1;
           c=c-1;
       }
       i=c/2;
       a=a+i;
       b=b+i;
        x=a+b;

    }
    else if(a<b && b-a<=c)
    {
        while(a!=b)
        {
            a=a+1;
            c=c-1;
        }
        i=c/2;
        a=a+i;
        b=b+i;
        x=a+b;
    }
    else if(a>b && a-b>c)
    {
        b=b+c;
        i=a-b;
        a=a-i;
        x=a+b;
    }
    else if(a<b && b-a>c)
    {
        a=a+c;
        i=b-a;
        b=b-i;
        x=a+b;
    }
    printf("%d",x);
    return 0;
}

#include<stdio.h>

int main(){
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	while(c){
		if(a>b) b++;
		else a++;
		c--;
	}
	printf("%d",a > b ? b*2 : a*2);
	return 0;
}

#include<stdio.h>

int main()
{
    int left,right,ambidexter;
    scanf("%d %d %d",&left,&right,&ambidexter);
    int max_team,difference;
    if (left==right)
    {
        ambidexter=ambidexter/2;
        max_team=left+right+(ambidexter*2);
        printf("%d\n",max_team);
    }
    else if (left > right)
    {
        difference=left-right;
        if (ambidexter>=difference)
        {
            ambidexter-=difference;
            ambidexter=ambidexter/2;
            max_team=left+left+(2*ambidexter);
            printf("%d\n",max_team);
        }
        else if (ambidexter<difference)
        {
            right+=ambidexter;
            max_team=right+right;
            printf("%d\n",max_team);
        }
    }
    else if (left < right)
    {
        difference=right-left;
        if (ambidexter>=difference)
        {
            ambidexter-=difference;
            ambidexter=ambidexter/2;
            max_team=right+right+(ambidexter*2);
            printf("%d\n",max_team);
        }
        else if (ambidexter<difference)
        {
            left+=ambidexter;
            max_team=left+left;
            printf("%d\n",max_team);
        }
    }
    return 0;
}

#include<stdio.h>
int main()
{
    int l,r,a,x,z;
    scanf("%d%d%d",&l,&r,&a);
    if(l==r && r==a)
    {
        printf("%d",l+r+a/2+a/2);
    }
    else
    {

    if(l>r)
    {
        x=l-r;
        if(x<=a)
        {
            r=r+x;
            a=a-x;
        }
        else
        {
            r=r+a;
            x=x-a;
            l=l-x;
            a=0;
        }

    }
    else
    {
        x=r-l;
        if(x<=a)
        {
            l=l+x;
            a=a-x;

        }
        else
        {
            l=l+a;
            x=x-a;
            r=r-x;
            a=0;
        }

    }

       printf("%d",l+r+a/2+a/2);

}
}

#include<stdio.h>
int main()
{
    int l,r,a,t,x,k,max,min,ans;
  scanf("%d %d %d",&l,&r,&a);
  if((l==0||r==0)&&(a==0))
    ans=0;
   if((l==0||r==0)&&(a!=0))
   {
       if(l==0)
        k=r;
       else
        k=l;
     if(a<=k)
        ans=2*a;
     else
        ans=2*k;
   }
   min=(l<r)?l:r;
   max=(l>r)?l:r;
   x=max-min;
   if(x>=a)
   ans=2*(min+a);
   if(x<a)
   {
       min=min+x;
       t=a-x;
       ans=2*(min+t/2);
   }
   if(x==0)
   {
       ans=2*(min+a/2);
   }
   printf("%d",ans);
   return 0;
}

#include<stdio.h>
int main(){
int n,m,a,c,min,max,k;
scanf("%d %d %d",&n,&m,&a);
if(n!=m){
if(n<m)
{
min=n;
max=m;
}
else{
min=m;
max=n;
}
min=min+a;

if(min<max)
printf("%d\n",min*2);
else{
k=min-max;
if(k%2==0)
printf("%d\n",(max*2)+k);
else
printf("%d\n",(max*2)+(k-1));

}
}
else{
min=n*2;
if(a%2==0)
printf("%d\n",min+a);
else
printf("%d\n",(min+(a-1)));

}

return 0;
}

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

     int l,r,a,t,sum=0;
     scanf("%d %d %d",&l,&r,&a);
     if(l>r)
     {
         t=l;
         l=r;
         r=t;
     }
     sum=sum+2*l;
     r=r-l;
     if(r<a)
     {
         a=a-r;
         sum=sum+2*r;
         if(a>0)
         {
             if(a%2==0)
             {
                 sum=sum+a;

             }
             else{
                sum=sum+a-1;
             }

         }
     }
     else
     {
         sum=sum+2*a;
     }

    printf("%d",sum);

}

#include<stdio.h>
int main ()
{
    int a,b,c,min,max,x,y;
    scanf("%d%d%d",&a,&b,&c);
    if(a>=b)
    {
        min=b;
        max=a;
        x=max-min;
        if(x<=c)
        {
        	y=c-x;
        	y=y/2;
        	printf("%d\n",(max+y)*2);
		}
		else
		{
			printf("%d\n",(min+c)*2);
		}
	}
	else
	{
		min=a;
		max=b;
		x=max-min;
        if(x<=c)
        {
        	y=c-x;
        	y=y/2;
        	printf("%d\n",(max+y)*2);
		}
		else
		{

			printf("%d\n",(min+c)*2);
		}
	}
	return 0;
 }

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

    return 0;
}

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

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

    return 0;
}

///I am Groot |*|
#include <stdio.h>

int main()
{
    int l,r,a,s;
    scanf("%d%d%d",&l,&r,&a);
    if(l<r)
    {
        s=l;
        l=r;
        r=s;
    }
    if(a<l-r)
        {printf("%d\n",2*(r+a));}
    else
        {printf("%d\n",(l+r+a)/2*2);}
        return 0;
}

#include<stdio.h>
int main()
{
    int l,r,a,result,ans,r1,l1;
    scanf("%d%d%d",&l,&r,&a);
    if(l==r){
        l=l+(a/2*2)/2;
        l=l*2;
        printf("%d\n",l);
        return 0;
    }
    if(l>r){
        r1=r+a;
        l1=l;
            if(l1>r1){
        ans=r1*2;
    }
    else
        ans=(l+r+a)/2*2;
        }
    else{
     l1=l+a;
     r1=r;
    if(l1<r1){
        ans=l1*2;
    }
    else
        ans=(l+r+a)/2*2;}
    printf("%d\n",ans);
    return 0;
}

#include<stdio.h>
int main()
{
    int l,r,a,big,small,total,c,b,k,m;
    scanf("%d %d %d",&l,&r,&a);
    b=a%2;
    if(l==r)
        {total=l+r+((a-b));
        printf("%d",total);
        return 0;
        end(0);}
    else if(l>r)
        {big=l;
        small=r;}
    else
        {small=l;
        big=r;}

    c=small+a;
    if(big>=c)
        {total=2*c;
        printf("%d",total);
        return 0;
        end(0);}
    else
        {   k=big-small;
            m=a-k;
            {
                if(m%2==0)
                    m=m;
                else
                    m=m-1;
            }
            {
                if(m>0)
                    m=m;
                else
                    m=-m;
            }
            total=(2*big)+m;
            printf("%d",total);
            return 0;
            end(0);
        }
}

//left handers right handers and ambidexters
//Bismillahir Rahmanir Rahim
#include<stdio.h>
int main()
{
    int x,y,z,a,b,c;
    scanf("%d%d%d",&x,&y,&z);
    if(x<y)
    {
        a=x+z;
        if(a>y)
        {
            b=a-y;
            b=b/2;
            c=y*2+b*2;
        }
        else
        {
            c=a*2;
        }

    }
    else if(x>y)
    {
        a=y+z;
        if(a>x)
        {
            b=a-x;
            b=b/2;
            c=x*2+b*2;
        }
        else
        {
            c=a*2;
        }
    }
    else
    {
        b=z/2;
        c=x*2+b*2;
    }
    printf("%d\n",c);

    return 0;
}
/*

1 4 2
5 5 5
0 2 0

*/

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

int main(){
    setvbuf(stdout, NULL, _IONBF,0);
    int left;
    int right;
    int ambx;
    scanf("%i",&left);
    scanf("%i",&right);
    scanf("%i",&ambx);
    if(left>=0 && left<=100 && right>=0 && right<=100 && ambx>=0 && ambx<=100){
        while(ambx!=0){
            if(left>right){
                right+=1;
            }
            else if(right>left){
                left+=1;
            }
            else{
                right+=1;
            }
            ambx--;
        }
        if(left>right){
            right = right*2;
            printf("%i\n",right);
        }
        else if(left<right){
            left = left*2;
            printf("%i\n",left);
        }
        else{
            left = left*2;
            printf("%i\n",left);
        }
    }

    else{
        printf("\nNo division in command\n");
    }

    return 0;

}

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

int main()
{
    int l,r,a,n;
    scanf("%d %d %d",&l,&r,&a);
    n=a;
    for(int i=1;i<=n;i++)if(l<=r){l++;a--;}else{r++;a--;}
    if(l==0 || r==0)printf("0\n");else if(l==r)printf("%d\n",l+r);else if(l>r)printf("%d\n",r*2);else printf("%d\n",l*2);
    return 0;
}

#include<stdio.h>
int main()
{
   long long int rh,lh,ne,d,sum,div,i;
    scanf("%lld %lld %lld",&rh,&lh,&ne);

    d = ne;
    if(rh>lh){

        while(ne>0){
            if(lh == rh){
                break;
            }
            lh++;
            d--;
            ne--;
        }

        div = d/2;
        sum = (lh*2)  + (div*2);
        printf("%lld\n",sum);
    }
    else {

        while(ne>0){
            if(rh == lh){
                break;
            }
            rh++;
            d--;
            ne--;
        }

        div = d/2;
        sum = (rh*2)  + (div*2);
        printf("%lld\n",sum);
    }
    return 0;

}

#include <stdio.h>

int main() {
    int l, r, a;
    int ans;
    scanf ("%d %d %d", &l, &r, &a);
    if (l > r) {
        if (l - r >= a) {
            ans = (r + a) * 2;
        }
        else {
            ans = 2 * l + (a - (l - r)) / 2 * 2;
        }
    }
    else if (l == r) {
        ans = l + r + a / 2 * 2;
    }
    else {
        if (r - l >= a) {
            ans = (l + a) * 2;
        }
        else {
            ans = 2 * r + (a - (r - l)) / 2 * 2;
        }
    }

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

#include <stdio.h>
int min(int l,int r);
int max(int l,int r);
int main()
{
	int l,r,a,mi,ma,mini=0,maxi=0;
	scanf("%d %d %d",&l,&r,&a);
	if(l==0 || r==0)
		printf(0);
	if(a==0){
		if(l==r){
		printf("%d",2*l);
		return 0;
		}
		else{
		printf("%d",min(l,r)*2);
		return 0;
		}
	}
	mi=min(l,r);
	ma=max(l,r);
	if(mi+a<=ma){
		printf("%d",2*(mi+a));
		return 0;
	}
	if(mi+a>ma){
		mini=min(l,r);
		maxi=max(l,r);
		if(l!=r){
			a=a-(maxi-mini);
			mini=maxi;
		}
		if(a%2==0){
			mini+=(a/2);
			maxi+=(a/2);
			printf("%d",mini*2);
			return 0;
		}
		else{
			while(a>1){
				mini+=1;
				a--;
				if(a==1){
					break;
				}
				maxi+=1;
				a--;
				if(a==1){
					break;
				}
			}
			printf("%d",mini+maxi);
		}
	}
}
int max(int l,int r){
	int maximum=0;
	if(l>=r){
		maximum=l;
	}
	if(r>=l){
		maximum=r;
	}
	return maximum;
}

int min(int l,int r){
	int minimum=0;
	if(l<=r){
		minimum=l;
	}
	if(r<=l){
		minimum=r;
	}
	return minimum;
}

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

int main()
{
    int a,b,c,d,e;
    scanf("%d%d%d",&a,&b,&c);
    d=b-a;
    if (d<0)
        d=-d;
    e=c-d;
    if(e>=0)
        printf("%d",a+b+d+(e/2)*2);
    else
    {
        if(b>a)
        printf("%d",2*(a+c));
    else if (a>b)
        printf("%d",2*(b+c));

}
}

#include<stdio.h>

int main(){
    int l,r,a;
    int n = 0;
    scanf("%d",&l);
    scanf("%d",&r);
    scanf("%d",&a);
    if(l == r){
        n += l;
        int rem = a / 2;
        n += rem;
    }
    else{
        int rem;
        if(l > r){
            n = r;
            rem = l - r;
        }
        else{
            n = l;
            rem = r - l;
        }
        if(rem < a){
            n += rem;
            rem = a - rem;
            rem = rem / 2;
            n += rem;
        }
        else if(rem > a){
            n += a;
        }
        else{
            n += rem;
        }
    }
    printf("%d",n * 2);
    return 0;
}

#include<stdio.h>
int main()
{
	int l,r,a,b,x,y,z;
	while(scanf("%d %d %d",&l,&r,&a)!=EOF)
    {
	if(l>r){
		b=r+a;
		x=l-b;
		y=l+r+a-x;
		if(x<0)
            y=l+r+a;
            if(y%2!=0)
                y=y-1;
		printf("%d\n",y);
	}
	else if (r>l)
	{
		b=l+a;
		x=r-b;

        y=l+r+a-x;
        if(x<0)
            y=l+r+a;
            if(y%2!=0)
                y=y-1;
            printf("%d\n",y);
	}
	else if (l==r)
	{
		b=l+r;
		if(a%2==0){
		x=b+a;
		}
		else {
		x=b+a-1;
		}

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

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

int main() {
    int l,r,a;
    scanf("%d%d%d",&l,&r,&a);
    if(a==0){
        if(l>r)
            printf("%d",r+r);
        else if(l==r)
            printf("%d",l+r);
        else
            printf("%d",l+l);
    }
  else if(l==r){

       if(a%2==0){
           printf("%d",l+r+a);
       }
       else
           printf("%d",l+r+a-1);
   }
    else if((l==0&&r==0)||(l==0&&a==0)||(r==0&&a==0)){
        printf("0");
    }
   else if(l>r){
        if((a+r)<l){
            l=r+a;
                printf("%d",l+r+a);

        }
        else if((a+r)==l)
            printf("%d",a+r+l);
        else{
            int s=(a+r)-l;
            if(s%2==0){
                printf("%d",a+l+r);
            }
            else
                printf("%d",a+l+r-1);

    }
    }
   else if(r>l){
        if((a+l)<r){
            r=l+a;
                printf("%d",l+r+a);

        }
        else if((a+l)==r)
            printf("%d",a+r+l);
        else{
            int s=(a+l)-r;
            if(s%2==0){
                printf("%d",a+l+r);
            }
            else
                printf("%d",a+l+r-1);

    }
    }

    return 0;
}

#include <stdio.h>

int main()
{
	int l, r, a, _max, _min;
	scanf("%d %d %d", &l, &r, &a);
	if (l > r)
	{
		_max = l;
		_min = r;
	} else if (l < r)
	{
		_min = l;
		_max = r;
	} else
	{
		printf("%d", l + r + (a % 2 > 0 ? a - 1 : a));
		return 0;
	}
	if (_min + a <= _max)
		printf("%d", (_min + a) << 1);
	else
	{
		int b = _min + a - _max;
		printf("%d", (_max << 1) + (b % 2 > 0 ? b - 1 : b));
	}
	return 0;
}

#include<stdio.h>
int main()
{
    int l,r,a,total,total1,total2,total3,total4,team;
    scanf("%d%d%d",&l,&r,&a);
    total1=l+a;
    total2=r;
    total3=r+a;
    total4=l;
    if(total1<total2)
    {
        total=total2-total1;
        total2-=total;
        team=total1+total2;
        printf("%d",team);
    }
    else if(total3<total4)
    {
        total=total4-total3;
        total4-=total;
        team=total3+total4;
        printf("%d",team);
    }
    else
    {
       total=total1+total2;
       total/=2;
       team=total*2;
       printf("%d",team);
    }
return 0;

}

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

int main()
{
    int a,l,r,ans;
    scanf("%d%d%d",&l,&r,&a);
    if(a==0)
    {
        if(l<r)
            ans=2*l;
        else
            ans=2*r;
    }
    else if(l<r)
    {
        for(;a!=0;)
        {
            if(a>0&&l<r)
            {
                l++;
                a--;
            }
            else if(r==l&&a>1)
            {
                r++;
                l++;
                a-=2;
            }
            else if(r==l&&a==1)
                break;
        }
        if(l<r)
            ans=2*l;
        else
            ans=2*r;
    }
    else if(r<l)
    {
        for(;a!=0;)
        {
            if(a>0&&r<l)
            {
                r++;
                a--;
            }
            else if(r==l&&a>1)
            {
                r++;
                l++;
                a-=2;
            }
            else if(r==l&&a==1)
                break;
        }
        if(r<l)
            ans=2*r;
        else
            ans=2*l;
    }
    else
    {
        if(a%2==0)
            ans=r+l+a;
        else
            ans=r+l+a-1;
    }
    printf("%d",ans);
    return 0;
}

#include <stdio.h>
unsigned short absv(unsigned short, unsigned short);
unsigned short min(unsigned short, unsigned short);
int main()
{
    unsigned short l, r, a, n, k;
    scanf("%hu%hu%hu", &l, &r, &a);
     k = absv(l, r);
    if(a < k){
      n = (a + min(l, r)) * 2;

    }else{
        a -= k;
        n = k + l + r + (a - a % 2);

    }
    printf("%hu",  n);
    return 0;
}
unsigned short absv(unsigned short x, unsigned short y){
    return x > y ? x - y : y - x;
}
unsigned short min(unsigned short x, unsigned short y){
    return x < y ? x : y;
}

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

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

int main()
{
    int l,r,a,i,j,k,s=0;
    scanf("%d%d%d",&l,&r,&a);
    if(l==0 && a==0) printf("0");
    else if(r==0 && a==0) printf("0");
    else if(l>r) {s+=r;l=l-r;
    if(l<=a) a=a+l;
    else a=a*2;
    k=a/2;
    s+=k;
    printf("%d",s*2);
    }
    else if(l==r) {s+=r;l=l-r;
    if(l<=a) a=a+l;
    else a=a*2;
    k=a/2;
    s+=k;
    printf("%d",s*2);
    }
    else {s+=l;r=r-l;
    if(r<=a) a=a+r;
    else a=a*2;
    k=a/2;
    s+=k;
    printf("%d",s*2);
    }

        return 0;
}

#pragma warning(disable:4996)
#include <stdio.h>
#include <malloc.h>
#include <math.h>
#include <stdlib.h>
#define N 100
#define EPS 1E-5
//#define min(a,b) (a>b) ? b : a
/*int lol(const void *x1, const void *x2)
{
	return *(int*)x1 - *(int*)x2;
}
int gcd(int a, int b)
{
	int c;
	while (b)
	{
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}*/
int Min(int a, int b)
{
	return (a > b) ? b : a;
}
int main(void)
{
	int l, r, a;
	int i = 0, max = 0;
	scanf("%i%i%i", &l, &r, &a);
	for (i = 0; i <= a; i++)
		if ((l + i == r - (a - i) && l + i > max) || Min(l + i, r + (a - i)) > max)
			max = Min(l + i, r + (a - i));
	printf("%i", max * 2);
	return 0;
}

#include<stdio.h>

int main(){
	int left,right,both,total;
	while(~scanf("%d%d%d",&left,&right,&both)){
		//while(left!=right){
		total=0;
			int t=both;
			if(left<right){
				both-=right-left;
				if(both<=0){
					left+=t;
					total=left*2;
				}else{
					left+=both;
					total=right*2+both/2*2;
				}
			}
			else if(left>right){
				both-=left-right;
				if(both<=0){
					right+=t;
					total=right*2;
				}else{
					total=left*2+(both/2)*2;
				}
			}
			else{
				total=left*2+(t/2)*2;
			}
		//}
		printf("%d\n",total);
	}
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main(){
		int i,j,r,l,a,cnt;
		while(scanf("%d %d %d ",&l,&r,&a)!=EOF){
				cnt=0;
				if(l>r){
						while(r!=0){
								r--;
								l--;
								cnt++;
						}
						while(l!=0){
								if(a==0)break;
								l--;
								a--;
								cnt++;
						}
						if(a>=2){
								cnt+=a/2;
						}
						printf("%d\n",2*cnt);

				}
				else if(r>l){
						while(l!=0){
								r--;
								l--;
								cnt++;
						}

						while(r!=0){
							if(a==0)break;
								r--;
								a--;
								cnt++;
						}
//	printf("cnt%d\n",cnt);
						if(a>=2){
								cnt+=a/2;
						}
						printf("%d\n",2*cnt);
				}
				else if(r==l){
						printf("%d\n",2*(l+a/2));
				}

		}

		return 0;
}

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

long long int test,i,j,n,count,flag,flag2,b1,l,m,u,r,q,d,x,max,max2,min,f,sum,a,b;

scanf("%lld%lld%lld",&l,&r,&b);
if(l>r){
   d=abs(l-r);
  if(d>b){
      printf("%lld",(r+b)*2);
  }else{
       printf("%lld",(l+((b-d)/2))*2);
  }

}else{
    if(l<r){
         d=r-l;
  if(d>b){
      printf("%lld",(l+b)*2);
  }else{
       printf("%lld",(r+((b-d)/2))*2);
  }
    }else{
        printf("%lld",2*r+(b/2)*2);
    }
}

    return 0;
}

#include<stdio.h>
#include<string.h>
int main()
{
    long long int sum,lft_hnd,rght_hnd,ambdxtr,small,big,total;

    scanf("%lld %lld %lld",&lft_hnd,&rght_hnd,&ambdxtr);
    total=lft_hnd+rght_hnd;
    small=(total-abs(lft_hnd-rght_hnd))/2;
    big=total-small;
    if(small+ambdxtr<big)
        sum=(small+ambdxtr)*2;
    else
    sum=(lft_hnd+rght_hnd+ambdxtr)-(lft_hnd+rght_hnd+ambdxtr)%2;

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

#include<stdio.h>
int main()
{
    int l,r,a,temp;
    scanf("%d %d %d",&l,&r,&a);
    while(1){
        y:if(a==0){
            if(l>=r){
                printf("%d",r*2);
            }
            else{
                printf("%d",l*2);
            }
            break;
        }
        else{
            x:if(l==r){
                a=a/2;
                l=r;
                l=l+a;
                l=2*l;
                printf("%d",l);
                break;
            }
            else if(l>r){
                temp=l-r;
                if(temp<=a){
                    r=r+temp;
                    a=a-temp;
                    if(a==0){
                        goto y;
                    }
                    else{
                        goto x;
                    }
                }
                else{
                    r=r+a;
                    r=r*2;
                    printf("%d",r);
                    break;
                }
            }
            else if(l<r){
                temp=r-l;
                if(temp<=a){
                    l=l+temp;
                    a=a-temp;
                    if(a==0){
                        goto y;
                    }
                    else{
                        goto x;
                    }
                }
                else{
                    l=l+a;
                    l=l*2;
                    printf("%d",l);
                    break;
                }
            }
        }
    }
    return 0;
}

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

#include <stdio.h>
int main()
{
	int l,r,a,max;
	scanf("%d %d %d",&l,&r,&a);
		if(l==r)
		{
		l=l+a/2;
		r=r+a/2;
		max=l+r;
		}
		if(l>r)
		{
			if(a>l-r)
			{
				a=a-(l-r);
				r=l;
				r=r+a/2;
				l=l+a/2;
				max=r+l;
			}
			else
		   {
				max=2*(r+a);
			}
		}
		if(r>l)
		{
			if(a>r-l)
			{

				a=a-(r-l);
				l=r;
				r=r+a/2;
				l=l+a/2;
				max=r+l;
			}
			else
			{
				max=2*(l+a);
			}
		}
		printf("%d",max);
	return 0;
	}

#include <stdio.h>

int main()
{
    int l, r, a, b;

    scanf("%d %d %d", &l, &r, &a);

    if(l < r){
        b = r-l;
        if(b <= a){
            l += b;
            a -= b;

        }
        else{
            l += a;
            a = 0;
        }
    }
    else{
        b = l-r;
        if(b <= a){
            r += b;
            a -= b;
        }
        else{
            r += a;
            a = 0;
        }
    }

    a /= 2;
    r += a;
    l += a;

    if(r < l) printf("%d\n", r*2);
    else printf("%d\n", l*2);

    return 0;
}

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

#include <stdio.h>

int main( )
{
	int l,r,a, team=0;

	//printf("Enter l, r, a:");
	scanf("%d%d%d", &l, &r, &a);
	//printf("left=%d, right=%d, ambi=%d\n", l,r,a);

	if (l ==r)
	{
		team += l + r;
		if(a%2 ==0)
			team += a;
		else
			team += (a-1);
	}
	else if ( l < r)
	{
		team += 2*l;
		r = r-l;
		if( a < r)
		{
			team += 2*a;

		}
		else
		{
			team += 2*r;
			a = a-r;
			if(a%2 ==0)
				team += a;
			else
				team += (a-1);
		}
	}
	else
	{
		team += 2*r;
		l = l-r;
		if( a < l)
		{
			team += 2*a;

		}
		else
		{
			team += 2*l;
			a = a-l;
			if(a%2 ==0)
				team += a;
			else
				team += (a-1);
		}
	}
 printf("%d", team);
}

#include <stdio.h>

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

int main(){

int l,r,a,s=0,t;//i,j,k;

scanf("%i %i %i",&l,&r,&a);

if (r==l){
	s = 2*l;
	s+= (a%2==0)? a: a-1;
	}
else{
	t = max(l,r) - min(l,r);
	s = 2*min(l,r) + 2*min(a,t);
	if ( t < a ){
		t = (a-t);
		s += (t % 2 == 0 ) ? t : t-1;
	}
}

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

#include<stdio.h>
#include<stdlib.h>
int main(l,r,a)
{scanf("%d%d%d",&l,&r,&a);
int t,s;
if(l<r)
{
t=l;
l=r;
r=t;
}
if(a<=(l-r))
s=2*(r+a);
else
s=2*(l+(a-l+r)/2);
printf("%d",s);
}

#include <stdio.h>
int min(int a,int b)
{
    if(a<b) return a;
    else    return b;
}
int max(int a,int b)
{
    if(a>b) return a;
    else    return b;
}
int abs(int a)
{
    if(a<0) return -a;
    else    return a;
}
int main(void) {
	int f,s,t,l,r,a;
	scanf("%d%d%d",&l,&r,&a);

	f=min(l,r);
	s=min(abs(max(l,r)-f),a);
	t=a-s;

	if(t<0) t=0;

	printf("%d",(f+s+t/2)*2);
	return 0;
}

#include <stdio.h>
#define min(a,b) (a>b?b:a)

int main() {
	int l,r,a;
	scanf("%d %d %d",&l,&r,&a);

	if (l > r) {
	    int x = l - r;
		if (x > a) {
			r += a;
			a = 0;
		} else {
			r += x;
			a -= x;
		}
	} else if (l < r) {
	    int x = r - l;
		if (x > a) {
			l += a;
			a = 0;
		} else {
			l += x;
			a -= x;
		}
	}

	if (l == r) {
		l+=(a/2);
		r+=(a/2);
	}

	printf("%d\n", min(l,r)*2);
	return 0;
}

#include<stdio.h>
main()
{
    int l,r,a,range=0,x,y,t;
    scanf("%d%d%d",&l,&r,&a);

    if(l<=r)
    {
        x=r; y=l;
    }
    else
    {
        x=l; y=r;
    }

        if(y+a<=x)
        {
            range=(y+a)*2;
        }
        else
        {
            t=(a+y-x)/2;
            range=(2*x)+(2*t);
        }

    printf("\t%d",range);

    return 0;
}

#include<stdio.h>

int main()
{
    int l,r,b;
    scanf("%d%d%d",&l,&r,&b);
    if(l<r)
    {
        while(l!=r)
        {
            if(b==0)
            {
                break;
            }
            l++;
            b--;
        }
        l=l+b/2;
        r=l;
    }
    else if(r<l)
    {
        while(r!=l)
        {
            if(b==0)
            {
                break;
            }
            r++;
            b--;
        }
        r=r+b/2;
        l=r;
    }
    else if(l==r)
    {
        l=l+b/2;
        r=l;
    }
    printf("%d",l+r);
}

#include<stdio.h>
int main()
{
    int l,r,a,count=0,flag;
    scanf("%d %d %d",&l,&r,&a);
    if(l<=r)
        {
            count=l*2;
            r=r-l;
            flag=0;
        }
    else
        {
            count=r*2;
            l=l-r;
            flag=1;
        }
    if(flag==0)
    {
        if(a<=r)
            count=count+(a*2);
        else
        {
            count=count+(r*2);
            a=a-r;
            if(a%2==0)
                count=count+a;
            else
                count=count+a-1;
        }
    }
    if(flag==1)
    {
        if(a<=l)
            count=count+(a*2);
        else
        {
            count=count+(l*2);
            a=a-l;
            if(a%2==0)
                count=count+a;
            else
                count=count+a-1;
        }
    }
    printf("%d",count);
    return 0;
}

#include<stdio.h>
int main()
{
    int r,l,a,s,min,n,max;
    scanf("%d%d%d",&r,&l,&a);
    if(r>l){ min=l;
    max=r;}
    else {min=r;
    max=l;}
    if(r!=0 || l!=0){
            if(r==l){n=(r+(a/2))*2;}
       else{ s=max-min;
        if(s<a){a=(a-s)/2;
                n=(min+s+a)*2;}
        else {n=(min+a)*2;}
    }}
    else {
if(a%2==0) n=a;
else n=a-1;}
    printf ("%d",n);
}

#include<stdio.h>
int main(){
	int l,r,am;
	int min=0,max=0;
	scanf("%d %d %d",&l,&r,&am);

	min=(l>r)?r:l;
	max=(r>l)?r:l;
	if((min+am)<=max)
        printf("%d\n",2*(min+am));
	else
	    printf("%d\n",2*(max+(am-max+min)/2));

	return 0;
}

#include<stdio.h>

int main ()
{
	int a,b,c,tong;
	scanf("%d %d %d",&a,&b,&c);
	tong = a+b+c ;
	if(a!=0&&b!=0&&c!=0)
	{
		if(a<b)
		{
			if((a+c)<b) printf("%d",(a+c)*2);
			else {
				if(tong%2==0) printf("%d",tong);
				else printf("%d",tong - 1 ) ;
			}
		}
		if(a>b)
		{
			if((b+c)<a) printf("%d",(b+c)*2);
			else {
				if(tong%2==0) printf("%d",tong);
				else printf("%d",tong - 1 ) ;
			}
		}
		if(a==b)
		{
			if(tong%2==0) printf("%d",tong);
			else printf("%d",tong - 1 ) ;
		}
	}
	else if(c==0)
	{
		if(a!=0&&b!=0)
		{
			if(a<b) printf("%d",a*2);
			else printf("%d",b*2);
		}
		else if(a==0&&b!=0) printf("%d",0);
		else if(b==0&&a!=0) printf("%d",0);
		else if(a==0&&b==0) printf("%d",0);
	}
	else if(a==0||b==0&&c!=0)
	{
		if(tong%2==0) printf("%d",tong);
		else printf("%d",tong - 1 ) ;
	}
}

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

int main()
{
    int l,r,a,count;
    scanf("%d%d%d",&l,&r,&a);
    count=0;
    while(count<a){
        if(l>(r+a)){
            r=r+a;
            goto x;
        }
        if(r>(l+a)){
            l=l+a;
            goto x;
        }
        if(l<r){
            l++;
            count++;
        }
        if(l==r){
            if((a-count)%2==0){
                l=l+(a-count)/2;
                r=r+(a-count)/2;
                goto x;
            }
            else{
                l=l+(a-count-1)/2;
                r=r+(a-count-1)/2;
                goto x;
            }
        }
        if(r<l){
            r++;
            count++;
        }
    }
    x:
        if(l<=r)
            printf("%d",2*l);
        else
            printf("%d",2*r);
    return 0;
}

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

int main()
{
    int l,r,a,c;
    scanf("%d %d %d",&l,&r,&a);
    if(l<r){
        c=r-l;
        if(c>=a){
            l=l+a;
            r=l;
        }
        else {
            l=l+c;
            a=a-c;
            a=a/2;
            l=l+a;
            r=r+a;
        }
    }
    else if(r<l){
        c=l-r;
        if(c>=a){
            r=r+a;
            l=r;
        }
        else {
            r=r+c;
            a=a-c;
            a=a/2;
            l=l+a;
            r=r+a;
        }
    }
    else {
        a=a/2;
        l=l+a;
        r=r+a;
    }
    printf("%d",2*l);
    return 0;
}

#include<stdio.h>
int main()
{
    int a,b,c,i,j,x,y,z,ans;
    scanf("%d%d%d",&a,&b,&c);
    if(a>b){
            x=a;
            y=b;
    }
    else{
        x=b;
        y=a;
    }
    if((y+c)>x){
        ans=2*x+2*((y+c-x)/2);
        printf("%d",ans);
    }
    else if((y+c)<x){
        ans=2*(y+c);
        printf("%d\n",ans);
    }
    else if(a==b){
        ans=a+b+2*(c/2);
        printf("%d\n",ans);
    }
    return 0;
}

#include <stdio.h>

int main()
{
    int l, r, a, s;
    scanf("%d%d%d",&l,&r,&a);
    printf("%d",(l+r+a)/2*2);
}

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

int main() {
    int l,u,a;
    scanf("%d %d %d",&l,&u,&a);
    int min,max;
    if(l<u){
        min=l;
        max=u;
    }

  else if(u<l){
        min=u;
        max=l;
    }

    int x=(a/2)*2;

     if(l==u)
    printf("%d",2*l+x);
   else if((min+a)<max)
            printf("%d",2*(min+a));
    else if((min+a)>max)
        printf("%d",2*max+(a-max)/2);

    }

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

#include<stdio.h>

int main()
{
	int l, r, a, tmp=0;
	scanf("%d %d %d", &l, &r, &a);

	int total=0;

	if((l==0 && a==0)|| (r==0 && a==0))
		total=0;

	else if(l==0)
	{
		if(r>=a)
			total=2*a;
		else
		{
			total=2*r;
			tmp=a-r;
			if(tmp%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else if(r==0)
	{
		if(l>=a)
			total=2*a;
		else
		{
			total=2*l;
			tmp=a-l;
			if(tmp%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else if(l>r)
	{
		if((r+a)<=l)
			total=2*(r+a);

		else if((r+a)>l)
		{
			tmp=l-r;
			total=(2*l);
			a=a-tmp;
			if(a%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else if(r>l)
	{
		if((l+a)<=r)
			total=2*(l+a);

		else if((l+a)>r)
		{
			tmp=r-l;
			total=(2*r);
			a=a-tmp;
			if(a%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else
	{
		total=2*r;
		if(a%2==0)
			total=total+a;
		else
			total=total+a-1;
	}
	printf("%d", total);
}

#include<stdio.h>
int smaller(int a, int b){
    if(a>b){
        a = b;
    }
    return a;
}
int larger(int a, int b){
    if(b>a){
        a = b;
    }
    return a;
}
int main()
{
    int x,y,z,temp1,temp2;
    scanf("%d%d%d",&x,&y,&z);
    temp1 = smaller(x,y);
    temp2 = larger(x,y);

    while(temp1 != temp2){
        temp1 = temp1 + 1;
    }
    if(z%2!=0){
        z = z - 1;
    }
    int total_player;
    total_player = temp1 + temp2 + z;
    if(y==0 || x==0){
        total_player = 0;
    }
    printf("%d",total_player);
    return 0;
}

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

int main()

{
    long long a,b,c,n,r;
    scanf("%I64d %I64d %I64d",&a,&b,&c);
    if(c==0)
    {
        if(a!=b){printf("No");}
        else{printf("Yes");}
    }

    else{
    n=(b-a+c)/c;
    if(n>0){

    r=a+(n-1)*c;
    if(r==b)
    {
        printf("Yes");
    }
    else{printf("No");}}
    else{printf("No");}

}}

#include <stdio.h>

int main( )
{
	int l,r,a, team=0;

	printf("Enter l, r, a:");
	scanf("%d%d%d", &l, &r, &a);
	printf("left=%d, right=%d, ambi=%d\n", l,r,a);

	if (l ==r)
	{
		team += l + r;
		if(a%2 ==0)
			team += a;
		else
			team += (a-1);
	}
	else if ( l < r)
	{
		team += 2*l;
		r = r-l;
		if( a < r)
		{
			team += 2*a;

		}
		else
		{
			team += 2*r;
			a = a-r;
			if(a%2 ==0)
				team += a;
			else
				team += (a-1);
		}
	}
	else
	{
		team += 2*r;
		l = l-r;
		if( a < l)
		{
			team += 2*a;

		}
		else
		{
			team += 2*l;
			a = a-l;
			if(a%2 ==0)
				team += a;
			else
				team += (a-1);
		}
	}
 printf("%d", team);
}

#include<stdio.h>
int main(){
	int a, b, c,l,r,sum;
	scanf("%d%d%d", &a, &b, &c);
	l=a+c;
	r=b+c;
	sum=l+r-c;
	if ((a==0 && c==0) || (b==0 && c==0)) printf("%d\n", 0);
	else if (sum%2==0) printf("%d\n",  sum);
	else printf("%d\n", sum-1);

	return 0;
}

#include<stdio.h>
int main()
{
	int l,x,m,r,a,n;
	scanf("%d%d%d",&l,&r,&a);
	if(l==r)
	{   start:
		if(a%2!=0 && a!=0)
	{	x=l+r+a-1;}
		else
	{	x=l+r+a; }
	printf("%d\n",x);
	}
	else if(l>r)
	{m=l-r;
	if(a-m>0)
	r=r+m;
	a=a-m;
	goto start;}

	else if(l<r)
	{
	m=r-l;
	if(a-m>0)
	l=l+m;
	a=a-m;
	goto start;
	}
	else
	printf("0\n");

}

#include<stdio.h>
#include<stdlib.h>
int main()
{
    int l,r,a;
    scanf("%d %d %d",&l,&r,&a);
    if(l>r)
    {
        r+=a;
        if(r>l)
        {
            printf("%d\n",l*2);
        }
        else printf("%d\n",r*2);
    }
    else if(r<l)
    {
        l+=a;
        if(l>r)
        {
            printf("%d\n",(l-r));
        }
        else
            printf("%d\n",(r-l));
    }
    else
    {
        if((l+r+a)%2 == 0)
        {
            printf("%d\n",l+r+a);
        }
        else
        {
            printf("%d\n",l+r+a-1);
        }
    }
    return 0;
}

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

int main(void) {

	setvbuf(stdout, NULL, _IONBF, 0);
	int l;
	int r;
	int a;

	printf("Enter a number of players in this way l r a \n");
	scanf("%i %i %i", &l, &r, &a);

	if(l == r) {
		if((a & 1) == 0) {
		printf("%i", l + r + a);
		} else {
			printf("%i", l + r + (a - 1));
		}
	}

		else if((l == 0 && a == 0)){
		printf("%i", l + a);
	}

	else if((r == 0 && a == 0)){
			printf("%i", r + a);
	}

	else if(l < r){
			if((a & 1) == 0) {
					printf("%i", l + r + (a - 1));
		} else {
			printf("%i", l + r + a);
		}
		}

	else{
		if((a & 1) == 0) {
				printf("%i", l + r + (a - 1));
	} else {
		printf("%i", l + r + a);
	}
	}

	return 0;

}

#include<stdio.h>

int main ()
{
	int a,b,c,tong;
	scanf("%d %d %d",&a,&b,&c);
	tong = a+b+c ;
	if(a!=0&&b!=0&&c!=0)
	{
		if(a<b)
		{
			if((a+c)<b) printf("%d",(a+c)*2);
			else {
				if(tong%2==0) printf("%d",tong);
				else printf("%d",tong - 1 ) ;
			}
		}
		if(a>b)
		{
			if((b+c)<a) printf("%d",(b+c)*2);
			else {
				if(tong%2==0) printf("%d",tong);
				else printf("%d",tong - 1 ) ;
			}
		}
		if(a==b)
		{
			if(tong%2==0) printf("%d",tong);
			else printf("%d",tong - 1 ) ;
		}
	}
	else if(c==0)
	{
		if(a!=0&&b!=0)
		{
			if(a<b) printf("%d",a*2);
			else printf("%d",b*2);
		}
		else if(a==0&&b!=0) printf("%d",0);
		else if(b==0&&a!=0) printf("%d",0);
		else if(a==0&&b==0) printf("%d",0);
	}
	if(a==0 || b==0)
	{
		if(tong%2==0) printf("%d",tong);
		else printf("%d",tong - 1 ) ;
	}
}
//dsfsdfsd

#include<stdio.h>

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

	if(r>l){
		l=l+a;
		if(l>r){
			a=l-r;
			if(a>0){
				t=(r+a/2)*2;
				printf("%d",t);
			}
			else printf("%d",r*2);
		}
		else printf("%d",l*2);
		return 0;
	}
	if(l>r){
		r=r+a;
		if(r>l){
			a=r-l;
			if(a>0){
				t=(l+a/2)*2;
				printf("%d",t);
			}
			else printf("%d",l*2);
		}
		else printf("%d",r*2);
		return 0;
	}
	if(l==r){
		if(a==0) printf("%d",r);
		else printf("%d",(l+a/2)*2);
	}
	return 0;
}

#include<stdio.h>
int main()
{
	int l,r,a,i,j,x;
	scanf("%d%d%d",&l,&r,&a);
	for(i=a;i>=0;i--)
	{
		if(l-r>=0)
		{
			x=r+i;
			if(x==l)
			{      if((a-i)%2==0)
				{	printf("%d",2*l+a-i);}
				else{printf("%d",2*l+a-i-1);
				}
			break;
			}
			else if(l>x)
			{
				printf("%d",2*(r+a));
				break;
			}
		}
		else
		{
			x=l+i;
			if(x==r)
			{      if((a-i)%2==0)
				{	printf("%d",2*l+a-i);}
				else{printf("%d",2*l+a-i-1);
				}	break;
			}
			else if(r>x)
			{
				printf("%d",2*(l+a));
					break;
			}
		}
	}
	return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main(){
		int i,j,r,l,a,cnt;
		while(scanf("%d %d %d ",&l,&r,&a)!=EOF){
				cnt=0;
				if(l>r){
						while(r!=0){
								r--;
								l--;
								cnt++;
						}
						while(l!=0){
								if(a==0)break;
								r--;
								a--;
								cnt++;
						}
						if(a>=2){
								cnt+=a/2;
						}
						printf("%d\n",2*cnt);

				}
				else if(r>l){
						while(l!=0){
								r--;
								l--;
								cnt++;
						}

						while(r!=0){
							if(a==0)break;
								r--;
								a--;
								cnt++;
						}
//	printf("cnt%d\n",cnt);
						if(a>=2){
								cnt+=a/2;
						}
						printf("%d\n",2*cnt);
				}
				else if(r==l){
						printf("%d\n",2*(l+a/2));
				}

		}

		return 0;
}

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

	return 0;
}

#include<stdio.h>
int main()
{
	int l,r,a, fl=0,fr=0, fe=0,d;

	scanf("%d%d%d",&l,&r,&a);

	if(a+l>r || a+r>l)
	{
		d=l-r;
		if(l<r && a>l){l=l+d;a=a-d;}
		else if(l>r && a>r){r=r+d;a=a-d;}
	}

	if(l>r) fr=1;
	else if (r>l) fl=1;
	else fe=1;

	if(fr) r+=a;
	else if(fl) l+=a;
	else if (fe) {l+=(a/2);r+=(a/2);}

	if(fl||fr)
	{	if(l>r)
			l-=(l-r);
		else
			r-=(r-l);
	}
	printf("%d",l+r);

	return 0;

}

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

int main(int argc, char *argv[]) {
    int l, r, a;
    scanf("%d%d%d", &l, &r, &a);
    if (abs(l - r) >= a)  {
        if (l > r) printf("%d", 2 * (r + a));
        else printf("%d", 2 * (l + a));
    }
    else {
        if (l > r) printf("%d", 2 * l + a - abs(l - r));
        else printf("%d", 2 * r + a - abs(l - r));
    }
    return 0;
}

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

}

#include<stdio.h>
#define min(a,b) a<b?a:b
int main()
{
    int m,n,a,s;
    scanf("%d%d%d",&m,&n,&a);
    if(a==0)
        printf("%d\n",min(m,n)*2);
    else
    {
        if(m<n)
        {
            m+=a;
            if(m<=n)
                s=min(m,n),printf("%d\n",2*s);
            else
                printf("%d\n",n*2+((m-n)/2)*2);
        }
        else
        {
            n+=a;
            if(n<=m)
                s=min(m,n),printf("%d\n",s*2);
            else
                printf("%d\n",m*2+((n-m)/2)*2);
        }
    }
    return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	int l,r,a,di,d;
	int re;
	scanf("%d%d%d",&l,&r,&a);
	di=0;
 if(r>l)
	{
		di=r-l;
		di=di>a?a:di;
		l=di+l;
		a=a-di;
		d=l;
	}

else if(l>r)
	{
		di=l-r;
		di=di>a?a:di;
		r=r+di;
		a=a-di;
		d=r;
	}
else
d=l;
printf("%d",d);
return 0;
}

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

}

#include<stdio.h>
int main()
{
    int l,r,a,i,x;
    scanf("%d%d%d",&l,&r,&a);
    if(l>r)
        x=l;
    else
        x=r;
    for(i=l;i<=x;i++)
    {
    if(l==r)
    {
        if(l=r=a)
            printf("%d",l+r+(a/2)+(a/2));
        else
            printf("%d",l+r);
            break;
    }
    if(l<r)
    {
      l=l+a;
      if(l<r)
          r--;
      else
          l--;
    }
    else
    {
        r=r+a;
        if(r<l)
            l--;
        else
            r--;
        }
    }

}

#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
    int n,j,b,l,r,a,sum;
    scanf("%d %d %d",&l,&r,&a);
    if(l==r)
    {
        l=l+a/2;
        r=r+a/2;
    }
    else if(r>l && r<=a)
    {
        a=a-(r-l);
        l=r+a/2;
        r=r+a/2;
    }
    else if(r>l && r>a)
    {
        l=l+a;
        r=l;
    }
    else if(l>r && l>a)
    {
        r=r+a;
        l=r;
    }
    else if(l>r && l<=a)
    {
        a=a-(l-r);
        r=l+a/2;
        l=l+a/2;
    }
    sum=l+r;
    printf("%d\n",sum);

    return 0;
}

#include<stdio.h>
main()
{
    int l,r,a,d, large,small;

    scanf("%d%d%d",&l,&r,&a);
    if(l==0 || r==0)
       {
           printf("0");
       }

    else
    {
         if(l>r)
    {
        large=l;
        small=r;
    }
    else
    {
        large=r;
        small=l;
    }
    if((small+a)<=large)
    {
        d=2*(small+a);
        printf("\n\n%d",d);

    }
    else
    {
        d=small+large+a;
        if(d%2==0)
        {
            printf("\n\n%d",d);
        }
        else
        {
            d=d-1;
            printf("\n\n%d",d);
        }
    }

    }
    return 0;
}

#include <stdio.h>

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

#include<stdio.h>
#include<math.h>
int main()
{
    int l,r,a,x,y;
    scanf("%d%d%d",&l,&r,&a);

    x=abs(l-r);
    if(x!=0)
    {
    y=abs(x-a);
    printf("%d\n",a+l+r-y);
    }
    else
        printf("%d\n",((a+l+r)/2)*2);
    return 0;
}

#include<stdio.h>
#include<stdlib.h>
int main() {
int l,r,a,p,q,m,s = 0,k;
scanf("%d%d%d",&l,&r,&a);
if(l < r) {
	p = r - l;
if(p <= a) {
	s = a - p;
	l = l + p;
	} else {
		l = l + a;
	}

	if(l != r ) {
	  k = abs(r - l);
	  r = r - k;
	}
printf("%d\n",(l + r + s));
} else if(r < l) {
	p = l - r;
if(p <= a) {
	s = a - p;
	r = r + p;
	} else {
		r = r + a;
	}

	if(l != r ) {
	  k = abs(r - l);
	  l = l - k;
	}
printf("%d\n",(l + r + s));
} else {
	if(a % 2 == 0)
		printf("%d\n",(l + r + a));
	else
		printf("%d\n",(l + r + a -1 ));
}
}

#include<stdio.h>
#include<math.h>
#include<string.h>
int main()
{
    int n,j,b,l,r,a,sum;
    scanf("%d %d %d",&l,&r,&a);
    if(l==r)
    {
        l=l+a/2;
        r=r+a/2;
    }
    else if(r>l && r<=a)
    {
        a=r-l;
        l=r+a/2;
        r=r+a/2;
    }
    else if(r>l && r>a)
    {
        l=l+a;
        r=l;
    }
    else if(l>r && l>a)
    {
        r=r+a;
        l=r;
    }
    else if(l>r && l<=a)
    {
        a=l-r;
        r=l+a/2;
        l=l+a/2;
    }
    sum=l+r;
    printf("%d\n",sum);

    return 0;
}

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

    if(b>a){
       t=a;
       a=b;
       b=t;
    }
    again:
    if(a==b){
        r=2*(a+c/2);
    }
    else if(b+c<a){
        r=2*(b+c);
    }
    else{

        c=c-a+b;
        b=a;
        goto again;
    }
    if(a==0||b==0){
        r=0;
    }
    printf("%d",r);

    return 0;
}

#include<stdio.h>
int main()
{
         int l,r,a,ctr,min,min1,d,max;
         scanf("%d%d%d",&l,&r,&a);
         if(l==r)
         {
                   if(a%2!=0)a-=1;
                   ctr = l+r+a;
         }
         else
         {
                   min = l<r ? l:r;
                   max = l>r ? l:r;
                   d = max - min;
                   min1 = d<a ? d:a;
                   ctr = (min*2) + (min1*2);
         }
         printf("%d\n",ctr);
}

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

    return 0;
}

#include <stdio.h>

int main()
{
   unsigned int l, r, a;
   scanf("%u%u%u", &l, &r, &a);

   unsigned delta = 0;
   if(r > l){
       delta = r - l;
       delta = delta > a ? a : delta;
       l += delta;
       a -= delta;
   }else
   if(l > r)
   {
       delta = l - r;
       delta = delta > a ? a : delta;
       r += delta;
       a -= delta;
   }
   unsigned max_team_size = (l + a/2) * 2;
   printf("%d", max_team_size);
   return 0;
}

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

int main()
{
    int r,l,a;

    scanf("%d%d%d", &r,&l,&a);

    int t = r+l+a;

    if(r !=0 || l!=0)
    {
        if(t%2==0)
            printf("%d", t);
        else{
            t--;
            printf("%d", t);
        }
    }
    else
        printf("%d", 0);
    return 0;
}

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

int main(){

     int l, r, a;
     int count;
     scanf("%d %d %d", &l, &r, &a);

     if(l==0 && a==0){
            count=0;
            printf("%d", count);
            return 0;
     }
     if(r==0 && a==0){
            count=0;
            printf("%d", count);
            return 0;
     }
     if(r==0 && l==0){
            count=a;
            printf("%d", count);
            return 0;
     }

     while(1){
        if(a==0)
            break;

         if(l<r){
                l++;
                a--;
         }else if(l>=r){
                r++;
                a--;
         }
     }

    if(l>r){
      count=2*r;
    }else if(l<=r){
      count=2*l;
    }

    printf("%d",count);

     return 0;
}

#include<stdio.h>
int main()
{
    int n,i,j,a,b,c,x;
    scanf("%d %d %d",&a,&b,&c);
    if(a==b)
    {
        i=c/2;
        a=a+i;
        b=b+i;
        x=a+b;
    }
    else if(a>b)
    {
        b=b+c;
        if(b>a)
        {
            while(a!=b)
            {
            b=b-1;
            a=a+1;
            }
        }
        else if(b<a)
        {
            while(a!=b)
            {
                a=a-1;
            }
        }
        x=a+b;

    }
    else
    {
        a=a+c;
        if(b>a)
        {
            while(b!=a)
            {
                b=b-1;
            }
        }
        else if(b<a)
        {
            while(a!=b)
            {
                a=a-1;
                b=b+1;
            }
        }
        x=a+b;
    }
    printf("%d",x);
    return 0;
}

#include<stdio.h>
int main()
{
    int l,r,a,big,small,total,c,b,k,m;
    scanf("%d %d %d",&l,&r,&a);
    b=a%2;
    if(l==r)
        {total=l+r+((a-b));
        printf("%d",total);
        return 0;
        end(0);}
    else if(l>r)
        {big=l;
        small=r;}
    else
        {small=l;
        big=r;}

    c=small+a;
    if(big>=c)
        {total=2*c;
        printf("%d",total);
        return 0;
        end(0);}
    else
        {   k=big-small;
            m=a-k;
            {
                if(m>0)
                    m=m;
                else
                    m=-m;
            }
            total=(2*big)+m;
            printf("%d",total);
            return 0;
            end(0);
        }
}

#include<stdio.h>

int main()
{
	int l, r, a, tmp=0;
	scanf("%d %d %d", &l, &r, &a);

	int total=0;

	if((l==0 && a==0)|| (r==0 && a==0))
		total=0;

	else if(l==0)
	{
		if(r>=a)
			total=2*a;
		else
		{
			total=2*r;
			tmp=a-r;
			if(tmp%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else if(r==0)
	{
		if(l>=a)
			total=2*a;
		else
		{
			total=2*l;
			tmp=a-l;
			if(tmp%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else if(l>r)
	{
		if((r+a)<l)
			total=2*(r+a);

		else if((r+a)>l)
		{
			tmp=l-r;
			total=(2*l);
			a=a-tmp;
			if(a%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else if(r>l)
	{
		if((l+a)<r)
			total=2*(l+a);

		else if((l+a)>r)
		{
			tmp=r-l;
			total=(2*r);
			a=a-tmp;
			if(a%2==0)
				total=total+a;
			else
				total=total+a-1;
		}
	}

	else
	{
		total=2*r;
		if(a%2==0)
			total=total+a;
		else
			total=total+a-1;
	}
	printf("%d", total);
}

#include <stdio.h>

typedef long long ll;
typedef unsigned long long ull;

#define REP(i, n) for((i) = 0; (i) < (n); (i)++)
#define REP1(i, n) for((i) = 1; (i) <= (n); (i)++)

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

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

int main(void)
{
    int l, r, a;

    scanf("%d %d %d", &l, &r, &a);
    if (l == r) {
        printf("%d", (l + a / 2) * 2);
    } else if (l < r) {
        printf("%d", (l + min(r - l, a) + max(0, (a - min(r - l, a)))) * 2);
    } else {
        printf("%d", (r + min(l - r, a) + max(0, (a - min(l - r, a)))) * 2);
    }

    return 0;
}

#include<stdio.h>
int main()
{
	int l,x,m,r,a,n;
	scanf("%d%d%d",&l,&r,&a);
	if(l==r)
	{   start:
		if(a%2!=0 && a!=0)
	{	x=l+r+a-1;}
		else
	{	x=l+r+a; }
	printf("%d\n",x);
	}
	else if(l>r)
	{m=l-r;
	if(a-m>0)
	r=r+m;
	a=a-m;
	goto start;}

	else if(l<r)
	{
	m=r-l;
	if(a-m>0)
	l=l+m;
	a=a-m;
	goto start;
	}

}

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

long long int test,i,j,n,count,flag,flag2,b1,l,m,u,r,q,d,x,max,max2,min,f,sum,a,b;

scanf("%lld%lld%lld",&l,&r,&b);
if(l>r){
   b-=abs(l-r);
   if(b<=0){
       printf("%lld",2*(r+b));
   }else{
   printf("%lld",2*(b/2)+2*l);
   }
}else{
    if(l<r){
         b-=abs(l-r);
   if(b<=0){
       printf("%lld",2*(r+b));
   }else{
   printf("%lld",2*(b/2)+2*r);
   }
    }else{
        printf("%lld",2*r+(b/2)*2);
    }
}

    return 0;
}

#include<stdio.h>
int main()
{
    int a,b,c,i,j,ans,p,q;
    scanf("%d%d%d",&a,&b,&c);
    if(a>b){
        p=b+c;
        q=p-a;
        if(q>0){
            ans=2*a+2*(q/2);
        }
        else{
            ans=2*b;
        }
    }
    else if(b>a){
        p=a+c;
        q=p-b;
        if(q>0){
            ans=2*b+2*(q/2);
        }
         else{
            ans=2*a;
        }
    }
    else if(a==b){
        ans=a+b+2*(c/2);
    }
    printf("%d\n",ans);
    return 0;
}

#include<stdio.h>

int main(){
	int l,r,x;
	scanf("%d %d %d",&l,&r,&x);
	int a = l+x;
	int result1 = a > r ? r : a;
	int b = r+x;
	int result2 = b > l ? l : b;
	int result3;
	if(x%2==1){
		int c = l+x/2+1, d = r+x/2;
		result3 = c > d ? d : c;
		c = l+x/2, d = r+x/2+1;
		int result4 = c > d ? d : c;
		result3 = result3 > result4 ? result3 : result4;
		// printf("%d %d\n",result3, result4);
	}
	else{
		int c = l+x/2, d = r+x/2;
		result3 = c > d ? d : c;
	}
	int max = result1 > result2 ? result1 : result2;
	max = result3 > max ? result3 : max;

	// printf("%d %d %d",result1,result2,result3);

	printf("%d",max*2);
	return 0;
}

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

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

	return 0;
}


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

typedef long long ll;

#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)<(b))?(a):(b))
#define abs(k) (((k)>0)?(k):(-(k)))
#define sqr(k) ((k)*(k))
#define swap(a,b) a^=b^=a^=b
#define mod(a,b) (((a)%(b)+(b))%(b))
#define mode(a,b) a=mod(a,b)
#define mset(a) memset(a,0,sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))
#define inf 1000000000
#define linf 1000000000000000000LL
#define pi 3.14159265358979323846

void fileio_in_out()
{
     freopen(".in","r",stdin);
     freopen(".out","w",stdout);
}

void fileio_txt()
{
     freopen("input.txt","r",stdin);
     freopen("output.txt","w",stdout);
}

//==================================================

const ll md=1000000007LL;

int n=0;
int i,j,k,l;
ll m,t;
ll cnk[111][111],f[111][2],dp[111][11111];

ll pw(ll x,ll y)
{
   ll i,t=1;

   for(i=1LL<<62;i;i>>=1)
     {
       t=(t*t)%md;
       if(i&y)
         t=(t*x)%md;
     }

   return t;
}

int main()
{
    //fileio_in_out();
    //fileio_txt();

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

    for(i=0;i<=n;i++)
      {
        cnk[i][0]=cnk[i][i]=1;
        for(j=1;j<i;j++)
          cnk[i][j]=(cnk[i-1][j-1]+cnk[i-1][j])%md;
      }

    for(i=0;i<=n;i++)
      {
        f[i][0]=pw(cnk[n][i],m/n);
        f[i][1]=pw(cnk[n][i],m/n+1);
      }

    mset(dp);
    dp[0][0]=1;
    for(i=0;i<n;i++)
      for(j=0;j<=k;j++)
        for(l=0;l<=n;l++)
          {
            t=(i<m%n)?f[l][1]:f[l][0];
            dp[i+1][j+l]=(dp[i+1][j+l]+t*dp[i][j])%md;
          }

    printf("%I64d\n",dp[n][k]);

    //system("pause");
    return 0;
}

#include <stdio.h>

long long pow(long long x, long long y, long long z)
{
    long long p = 1;

    while (y) {
        if (y & 1) p = p * x % z;

        x = x * x % z;
        y >>= 1;
    }

    return p;
}

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

long long c[101][101];
long long a[101];
long long dp[101][10001];

int main()
{
    int n, k, mod = 1000000007, i, j, l;
    long long m;

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

    for (i = 0; i <= 100; i++) {
        c[i][0] = c[i][i] = 1;

        for (j = 1; j < i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
    }

    for (i = 0; i <= n; i++) a[i] = pow(c[n][i], m / n, mod);

    dp[0][0] = 1;

    for (i = 0; i < n; i++) {
        for (j = max(0, k - (n - i) * n); j <= i * n && j <= k; j++) {
            if (dp[i][j] == 0) continue;

            for (l = 0; l <= n && j + l <= k; l++) {
                long long x = a[l];

                if (m % n > i) x = x * c[n][l] % mod;

                dp[i + 1][j + l] = (dp[i + 1][j + l] + dp[i][j] * x % mod) % mod;
            }
        }
    }

    printf("%I64d\n", dp[n][k]);

    return 0;
}

#include<stdio.h>
#define mod 1000000007
long long f[200][200],dp[101][10001];
long long calc_pow(long long base , long long power)
{
    if(power == 0) return 1;

    long long half = calc_pow(base , power/2);

    if(power % 2)
        return ((half * half) % mod * base) % mod;

    return (half * half) % mod;
}
main()
{
    long long n,m,i,j,k,s;
    scanf("%I64d%I64d%I64d",&n,&m,&s);

    for(i=0; i<=100; i++)
        f[i][0] = 1;

    for(i=1; i<=100; i++)
        for(j=1; j<=i; j++)
            f[i][j] = (f[i-1][j] + f[i-1][j-1]) % mod ;

    long long pow[200][200];

    for(i=1; i<=n; i++)
        for(j=0; j<=n; j++)
            pow[i][j] = calc_pow(f[n][j] , (m-i)/n+1);

    for(i=0; i<=n; i++)dp[n][i] = pow[n][i];

    for(i=n-1; i>=1; i--)
    {
        for(j=0; j<=(n-i+1)*n ; j++)
        {
          for(k=0; k<=n; k++)
          {
              if(j - k <= (n-i)*n)
                dp[i][j] = (dp[i][j] + (pow[i][k] * dp[i+1][j-k] ) % mod )% mod;
          }
        }
    }

    printf("%I64d",dp[1][s]);

    return 0;
}

#include <stdio.h>
#define MOD (1000000007ULL)
#define min(a, b)  ( ((a) < (b)) ? (a) : (b) )

unsigned long long cnk[101][101], pows[101], pows2[101][101], dp[101][10001];

unsigned long long quick_pow(unsigned long long a, unsigned long long n)
{
    if (n == 0) {
        return 1;
    } else if ((n & 1ULL) == 0) {
        unsigned long long tmp = quick_pow(a, n / 2ULL);
        return (tmp * tmp) % MOD;
    } else {
        return (quick_pow(a, n - 1) * a) % MOD;
    }
}

void count_cnk(void)
{
    int i, j;
    cnk[0][0] = 1;
    for(i = 1; i < 101; ++i){
        cnk[i][0] = 1;
        for(j = 1; j < 101; ++j){
            cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % MOD;
        }
    }
}

int
main(void)
{
    int i, j, t;
    unsigned long long n, m, k;

    count_cnk();

    scanf("%I64u%I64u%I64u", &n, &m, &k);

    unsigned long long rem =  m % n;
    for (i = 1; i <= n; ++i) {
        if (rem) {
            pows[i] = m / n + 1;
            --rem;
        } else {
            pows[i] = m / n;
        }
        for (j = 0; j <= n; ++j) {
            pows2[i][j] = quick_pow(cnk[n][j], pows[i]);
        }
    }

    dp[0][0] = 1;
    for (i = 1; i <= n; ++i) {
        for (j = 0; j <= min(k, i * n); ++j) {
            for (t = 0; t <= min(n, j); ++t) {
                dp[i][j] = (dp[i][j] + dp[i - 1][j - t] * pows2[i][t]) % MOD;
            }
        }
    }

    printf("%I64u", dp[n][k]);
    return 0;
}

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

#define N	100
#define K	(N * N)
#define MD	1000000007

long long power(int a, long long k) {
	long long p;

	if (k == 0)
		return 1;
	p = power(a, k / 2);
	p = p * p % MD;
	if (k % 2)
		p = p * a % MD;
	return p;
}

int main() {
	static int ch[N + 1][N + 1], pp[N + 1][N + 1], dp[N + 1][K + 1];
	int n, k, h, i, j;
	long long m;

	scanf("%d%lld%d", &n, &m, &k);
	ch[0][0] = 1;
	for (i = 1; i <= n; i++) {
		ch[i][0] = 1;
		for (j = 1; j <= i; j++)
			ch[i][j] = (ch[i - 1][j] + ch[i - 1][j - 1]) % MD;
	}
	for (i = 0; i <= n; i++)
		for (j = 0; j <= i; j++)
			pp[i][j] = power(ch[i][j], m / n);
	dp[0][0] = 1;
	for (i = 0; i < n; i++)
		for (j = 0; j <= k; j++) {
			int x = dp[i][j];

			if (x == 0)
				continue;
			for (h = 0; h <= n && j + h <= k; h++)
				dp[i + 1][j + h] = (dp[i + 1][j + h] + (long long) x * pp[n][h] % MD * (i < m % n ? ch[n][h] : 1)) % MD;
		}
	printf("%d\n", dp[n][k]);
	return 0;
}

#include <stdio.h>

#define maxn 111

const int mod = (int) 1e9 + 7;

long long choose[maxn][maxn];

long long f[maxn][10001];
long long g[maxn][maxn];

long long power( long long a, long long b ) {
	long long ret = 1;

	a %= mod;
	while( b > 0 ) {
		if( b % 2 ) {
			ret = (ret * a) % mod;
		}

		b /= 2;
		a = (a * a) % mod;
	}

	return ret;
}

int main( void ) {
	long long n, m, k;
	scanf("%lld %lld %lld", &n, &m, &k);

	for( int i = 0; i < maxn; i++ ) {
		choose[i][0] = choose[i][i] = 1;
		for( int j = 1; j < i; j++ ) {
			choose[i][j] = (choose[i-1][j] + choose[i-1][j-1]) % mod;
		}
	}

	for( int i = 1; i <= n; i++ ) {
		for( int c = 0; c <= n; c++ ) {
			long long count = (m / n) + (m % n >= i ? 1 : 0);
			g[i][c] = power(choose[n][c], count);
		}
	}

	f[1][0] = 1;
	for( int i = 1; i <= n; i++ ) {
		for( int j = 0; j <= k; j++ ) if( f[i][j] > 0 ) {
			for( int c = 0; c <= n; c++ ) {
				if( j + c > k ) break;
				long long nways = (g[i][c] * f[i][j]) % mod;
				f[i+1][j+c] = (f[i+1][j+c] + nways) % mod;
			}
		}
	}

	printf("%lld\n", f[n+1][k]);

	return 0;
}

#include <stdio.h>

#define maxn 111

const int mod = (int) 1e9 + 7;

long long choose[maxn][maxn];

long long f[maxn][1001];
long long g[maxn][maxn];

long long power( long long a, long long b ) {
	long long ret = 1;

	a %= mod;
	while( b > 0 ) {
		if( b % 2 ) {
			ret = (ret * a) % mod;
		}

		b /= 2;
		a = (a * a) % mod;
	}

	return ret;
}

int main( void ) {
	long long n, m, k;
	scanf("%lld %lld %lld", &n, &m, &k);

	for( int i = 0; i < maxn; i++ ) {
		choose[i][0] = choose[i][i] = 1;
		for( int j = 1; j < i; j++ ) {
			choose[i][j] = (choose[i-1][j] + choose[i-1][j-1]) % mod;
		}
	}

	for( int i = 1; i <= n; i++ ) {
		for( int c = 0; c <= n; c++ ) {
			long long count = (m / n) + (m % n >= i ? 1 : 0);
			g[i][c] = power(choose[n][c], count);
		}
	}

	f[1][0] = 1;
	for( int i = 1; i <= n; i++ ) {
		for( int j = 0; j <= k; j++ ) if( f[i][j] > 0 ) {
			for( int c = 0; c <= n; c++ ) {
				if( j + c > k ) break;
				long long nways = (g[i][c] * f[i][j]) % mod;
				f[i+1][j+c] = (f[i+1][j+c] + nways) % mod;
			}
		}
	}

	printf("%lld\n", f[n+1][k]);

	return 0;
}

#include <stdio.h>
#define MOD 1000000007
#define min(a, b)  ( ((a) < (b)) ? (a) : (b) )

unsigned long long cnk[101][101], pows[101], pows2[101][101], dp[101][101];

unsigned long long quick_pow(unsigned long long a, unsigned long long n)
{
    if (n == 0) {
        return 1;
    } else if ((n & 1ULL) == 0) {
        unsigned long long tmp = quick_pow(a, n / 2ULL);
        return (tmp * tmp) % MOD;
    } else {
        return (quick_pow(a, n - 1) * a) % MOD;
    }
}

int
main(void)
{
    int n, k;
    unsigned long long m;
    scanf("%d%I64u%d", &n, &m, &k);
    cnk[0][0] = 1;

    int i, j, t;
    for(i = 1; i < 101; ++i){
        cnk[i][0] = 1;
        for(j = 1; j < 101; ++j){
            cnk[i][j] = (cnk[i - 1][j] + cnk[i - 1][j - 1]) % MOD;
        }
    }

    unsigned long long rem =  m % n;
    for (i = 1; i <= n; ++i) {
        if (rem) {
            pows[i] = m / n + 1;
            --rem;
        } else {
            pows[i] = m / n;
        }
        for (j = 0; j <= n; ++j) {
            pows2[i][j] = quick_pow(cnk[n][j], pows[i]);
        }
    }

    //printf("OPPA!");

    dp[0][0] = 1;
    for (i = 1; i <= n; ++i) {
        for (j = 0; j <= min(k, i * n); ++j) {
            for (t = 0; t <= min(n, j); ++t) {
                dp[i][j] = (dp[i][j] + dp[i - 1][j - t] * pows2[i][t]) % MOD;
            }
        }
    }

    printf("%I64u", dp[n][k]);
    return 0;
}


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

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

int main() {
	static char cc[1048576], *s = cc;
	long long x, y;

	scanf("%lld%lld", &x, &y);
	if (gcd(x, y) != 1) {
		printf("Impossible\n");
		return 0;
	}
	while (x > 1 || y > 1) {
		long long k;
		char c;

		if (x > y) {
			k = x / y;
			if (y == 1)
				k--;
			x %= y;
			c = 'A';
		} else {
			k = y / x;
			if (x == 1)
				k--;
			y %= x;
			c = 'B';
		}
		s += sprintf(s, "%lld%c", k, c);
	}
	printf("%s\n", cc);
	return 0;
}

#include<stdio.h>
typedef long long unsigned llu;
typedef long long ll;
typedef unsigned u;
llu G(llu a,llu b){return b?G(b,a%b):a;}
ll lx,ly;
ll egcd(ll a,ll b)
{
	long long r,q,x=0,y=1;lx=1;ly=0;
	u ee=1;
	while(b!=0)
	{
		q=a/b;
		r=b;b=a%b;a=r;
		r=x;x=lx-q*x;lx=r;
		r=y;y=ly-q*y;ly=r;
		if((ee^=1)&&(q-(b==0)))printf("%I64iB",q-(b==0));
		else if((q-(b==0)))printf("%I64iA",q-(b==0));
	}
	return a;
}
int main()
{
	llu a,b;u i,j,k;
	scanf("%I64u%I64u",&a,&b);
	if(G(a,b)!=1){printf("Impossible\n");return 0;}
	egcd(a,b);
	putchar('\n');
	return 0;
}

#include <stdio.h>

long long gcd(long long a,long long b){
    return b?gcd(b,a%b):a;
}
int main()
{
    long long x,y;
    scanf("%I64d%I64d",&x,&y);
    if(x==y){
        printf("Impossible\n");
        return 0;
    }
    else if(gcd(x,y)!=1){
        printf("Impossible\n");
        return 0;
    }
    else if(x==1){
        printf("%I64dB\n",y-1);
        return 0;
    }
    else if(y==1){
        printf("%I64dA\n",x-1);
        return 0;
    }
    else{
        while(x!=0 && y!=0){
            if(x==1){
                printf("%I64dB",y-1);
                break;
            }
            else if(y==1){
                printf("%I64dA",x-1);
                break;
            }
            else if(x>y){
                printf("%I64dA",x/y);
                x=x%y;
            }
            else if(x<y){
                printf("%I64dB",y/x);
                y=y%x;
            }

        }
    }

    return 0;
}

#include <stdio.h>

long long gcd(long long a,long long b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}
int main()
{
    long long x,y,test;
    scanf("%I64d %I64d",&x,&y);
    test=gcd(x,y);
    //printf("%I64d",test);
    if(test>1)
    {
        printf("Impossible");
        return 0;
    }
    else
    {
        while(x && y)
        {
            if(x>y)
            {
                printf("%I64dA",(x-1)/y);
                x=x%y;
            }
            else
            {
                printf("%I64dB",(y-1)/x);
                y=y%x;
            }
        }
    }
    return 0;
}

#include <stdio.h>

long long gcd(long long a,long long b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}
int main()
{
    long long x,y,test;
    scanf("%I64d %I64d",&x,&y);
    test=gcd(x,y);
    if(test>=1)
        printf("Impossible");
    else
    {
        while(x && y)
        {
            if(x>y)
            {
                printf("%I64dA",(x-1)/y);
                x=x%y;
            }
            else
            {
                printf("%I64dB",(y-1)/x);
                y=y%x;
            }
        }
    }
    return 0;
}

#include <stdio.h>

long long gcd(long a,long b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}
int main()
{
    long long x,y,test;
    scanf("%I64d %I64d",&x,&y);
    test=gcd(x,y);
    if(test>1)
        printf("Impossible");
    else
    {
        while(x && y)
        {
            if(x>y)
            {
                printf("%I64dA",(x-1)/y);
                x=x%y;
            }
            else
            {
                printf("%I64dB",(y-1)/x);
                y=y%x;
            }
        }
    }
    return 0;
}

#include <stdio.h>

long long gcd(long long a,long long b)
{
    if(a%b==0)
        return b;
    else
        return gcd(b,a%b);
}
int main()
{
    long long x,y,test;
    scanf("%I64d %I64d",&x,&y);
    test=gcd(x,y);
    printf("%I64d",test);
    if(test>1)
    {
        printf("Impossible");
        return 0;
    }
    else
    {
        while(x && y)
        {
            if(x>y)
            {
                printf("%I64dA",(x-1)/y);
                x=x%y;
            }
            else
            {
                printf("%I64dB",(y-1)/x);
                y=y%x;
            }
        }
    }
    return 0;
}


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

typedef struct node{
        int v;
        struct node *next;
} NODE;

char f[100000];

void dfs(int n, NODE *e[], char v[], int mode){
     v[n] = 1;
     if (!mode && f[n] == 1)return;
     NODE *tmp = e[n];
     while (tmp){
           if (!v[tmp->v] && !(mode && f[tmp->v] == 1))
              dfs(tmp->v, e, v, mode);
           tmp = tmp->next;
     }
     return;
}

int main(){
    int n, m, i, j, x, y;
    char f1 = 0, f2 = 0, v1[100000] = {}, v2[100000] = {};
    NODE *e[100000] = {}, *b[100000] = {}, *tmp;
    scanf("%d%d", &n, &m);
    for (i = 0 ; i < n ; ++i){
        scanf("%d", f + i);
        if (f[i] == 1)f1 = 1;
        else if (f[i] == 2)f2 = 1;
    }
    if (!f1 || !f2){
       while (n--)puts("0");
       return 0;
    }

    for (i = 0 ; i < m ; ++i){
        scanf("%d%d", &x, &y);
        --x, --y;
        tmp = calloc(1, sizeof(NODE));
        tmp->v = y, tmp->next = e[x], e[x] = tmp;
        tmp = calloc(1, sizeof(NODE));
        tmp->v = x, tmp->next = b[y], b[y] = tmp;
    }
    for (i = 0 ; i < n ; ++i)
        if (f[i] == 1)
           dfs(i, e, v1, 1);
    for (i = 0 ; i < n ; ++i)
        if (f[i] == 2)
           dfs(i, b, v2, 0);
    for (i = 0 ; i < n ; ++i)
        printf("%d\n", v1[i] && v2[i]);
    scanf(" ");
    return 0;
}

#include <stdio.h>

#define maxN 100010

struct {
    int to;
    int nextID;
} E[maxN], R[maxN];

int LE[maxN], RE[maxN];
int t[maxN], afs[maxN], lfs[maxN];

void dfs( int s ) {
    afs[s] = 1;

    int ID;
    for( ID = LE[s]; ID != 0; ID = E[ID].nextID )
	if( !afs[E[ID].to] ) dfs(E[ID].to);
}

void ofs( int s ) {
    lfs[s] = 1;

    if( t[s] == 1 ) return;

    int ID;
    for( ID = RE[s]; ID != 0; ID = R[ID].nextID )
	if( !lfs[R[ID].to] ) ofs(R[ID].to);
}

int main( void ) {
    int N, M;
    scanf("%i %i", &N, &M);

    int i;
    for( i = 1; i <= N; i++ )
	scanf("%i", &t[i]);

    for( i = 1; i <= M; i++ ) {
	int u, v;
	scanf("%i %i", &u, &v);

	E[i].to = v;
	E[i].nextID = LE[u];
	LE[u] = i;

	R[i].to = u;
	R[i].nextID = RE[v];
	RE[v] = i;
    }

    for( i = 1; i <= N; i++ )
	if( t[i] == 1 ) dfs(i);

    for( i = 1; i <= N; i++ )
	if( t[i] == 2 ) ofs(i);

    for( i = 1; i <= N; i++ )
	printf("%i%c", (afs[i] && lfs[i]) ? 1 : 0, (i == N) ? '\n' : ' ');

    return 0;
}

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

typedef struct node{
        int v;
        struct node *next;
} NODE;

void dfs(int n, NODE *e[], char v[]){
     NODE *tmp = e[n];
     v[n] = 1;
     while (tmp){
           if (!v[tmp->v])
              dfs(tmp->v, e, v);
           tmp = tmp->next;
     }
     return;
}

int main(){
    int n, m, i, j, x, y;
    char f[100000], f1 = 0, f2 = 0, v1[100000] = {}, v2[100000] = {};
    NODE *e[100000] = {}, *b[100000] = {}, *tmp;
    scanf("%d%d", &n, &m);
    for (i = 0 ; i < n ; ++i){
        scanf("%d", f + i);
        if (f[i] == 1)f1 = 1;
        else if (f[i] == 2)f2 = 1;
    }
    if (!f1 || !f2){
       while (n--)puts("0");
       return 0;
    }

    for (i = 0 ; i < m ; ++i){
        scanf("%d%d", &x, &y);
        --x, --y;
        tmp = calloc(1, sizeof(NODE));
        tmp->v = y, tmp->next = e[x], e[x] = tmp;
        tmp = calloc(1, sizeof(NODE));
        tmp->v = x, tmp->next = b[y], b[y] = tmp;
    }
    for (i = 0 ; i < n ; ++i)
        if (f[i] == 1)
           dfs(i, e, v1);
    for (i = 0 ; i < n ; ++i)
        if (f[i] == 2)
           dfs(i, b, v2);
    for (i = 0 ; i < n ; ++i)
        printf("%d\n", v1[i] && v2[i]);
    return 0;
}

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

typedef struct node{
        int v;
        struct node *pre, *next;
} NODE;

int e[100000][2], v[100001] = {};
char s[100001] = {}, f[100001];
NODE pre[100000] = {}, *prep[100001];

int cmp(const void *a, const void *b){
    int *x = (int*)a, *y = (int*)b;
    if (x[0] < y[0])return -1;
    if (x[0] > y[0])return 1;
    if (x[1] < y[1])return -1;
    if (x[1] > y[1])return 1;
    return 0;
}

void fill(int now, NODE *prep[]){
     do {/**/printf(" f: %d %d\n", now, prep[now]->v);
        if (!prep[now]->v)return;
        if (s[prep[now]->v])continue;
        s[prep[now]->v] = 1;
        fill(prep[now]->v, prep);
     }while (prep[now]->pre && (prep[now] = prep[now]->pre));
     return;
}

int main(){
    int n, m, i, j;
    char f1 = 0, f2 = 0;

    scanf("%d%d", &n, &m);
    for (i = 1 ; i <= n ; ++i){
        scanf("%d", f + i);
        if (f[i] == 1)f1 = 1;
        else if (f[i] == 2)f2 = 1;
    }
    if (!f1 || !f2){
       while (n--)puts("0");
       return 0;
    }

    for (i = 0 ; i < m ; ++i)
        scanf("%d%d", &e[i][0], &e[i][1]);
    qsort(e, m, sizeof(int) * 2, cmp);
    for (i = 0, j = 1 ; i < m ; ++i)
        while (e[i][0] > j)v[j++] = i;
    while (j <= n)v[j++] = m;

    for (i = 1 ; i <= n ; ++i){
        if (f[i] != 1)continue;
        int l, r, q[100000];
        char c[100001] = {};
        memset(pre, 0, sizeof(pre));
        q[0] = i, c[i] = 1;
        prep[i] = &pre[0];
        for (l = 0, r = 1 ; l < r ; ++l){
            for (j = v[q[l] - 1] ; j < v[q[l]] ; ++j){
                if (f[e[j][1]] == 1)continue;
                if (c[e[j][1]]){
                   /**/printf("c: %d %d %d %d\n", l, r, e[j][0], e[j][1]);
                   NODE *tmp = prep[e[j][1]];
                   do {
                      if (tmp->v == q[l])break;
                   }while (tmp->pre && (tmp = tmp->pre));
                   if (tmp->v == q[l])continue;
                   prep[e[j][1]]->next = calloc(1, sizeof(NODE));
                   prep[e[j][1]]->next->pre = prep[e[j][1]];
                   prep[e[j][1]] = prep[e[j][1]]->next;
                   prep[e[j][1]]->v = q[l];
                }
                else {
                   /**/printf("d: %d %d %d %d\n", l, r, e[j][0], e[j][1]);
                     c[e[j][1]] = 1;
                     pre[r].v = q[l];
                     prep[e[j][1]] = &pre[r];
                     q[r++] = e[j][1];
                }
                if (s[e[j][1]] || f[e[j][1]] == 2){
                  /**/printf("s: %d %d %d %d\n", l, r, e[j][0], e[j][1]);
                   s[e[j][1]] = 1;
                   fill(e[j][1], prep);
                }
            }
        }
    }
    for (i = 1 ; i <= n ; ++i)
        printf("%d\n", s[i]);
    return 0;
}

#include <stdio.h>

#define maxN 100010

struct {
    int to;
    int nextID;
} E[maxN];

int LE[maxN], P[maxN];
int t[maxN], afs[maxN], lfs[maxN];

void dfs( int s ) {
    afs[s] = 1;

    int ID;
    for( ID = LE[s]; ID != 0; ID = E[ID].nextID )
	if( !afs[E[ID].to] ) {
	    P[E[ID].to] = s;
	    dfs(E[ID].to);
	}
}

void ofs( int s ) {
    while( (s != 0) && (lfs[s] == 0) ) {
	lfs[s] = 1;
	s = P[s];

	if( t[s] == 1 ) break;
    }

    if( t[s] == 1 ) lfs[s] = 1;
}

int main( void ) {
    int N, M;
    scanf("%i %i", &N, &M);

    int i;
    for( i = 1; i <= N; i++ )
	scanf("%i", &t[i]);

    for( i = 1; i <= M; i++ ) {
	int u, v;
	scanf("%i %i", &u, &v);

	E[i].to = v;
	E[i].nextID = LE[u];
	LE[u] = i;
    }

    for( i = 1; i <= N; i++ )
	if( t[i] == 1 ) dfs(i);

    for( i = 1; i <= N; i++ )
	if( t[i] == 2 ) ofs(i);

    for( i = 1; i <= N; i++ )
	printf("%i%c", (afs[i] && lfs[i]) ? 1 : 0, (i == N) ? '\n' : ' ');

    return 0;
}

#include <stdio.h>

#define maxN 100010

struct {
    int to;
    int nextID;
} E[maxN];

int LE[maxN], P[maxN];
int t[maxN], afs[maxN], lfs[maxN];

void dfs( int s ) {
    afs[s] = 1;

    int ID;
    for( ID = LE[s]; ID != 0; ID = E[ID].nextID )
	if( !afs[E[ID].to] ) {
	    P[E[ID].to] = s;
	    dfs(E[ID].to);
	}
}

void ofs( int s ) {

    while( s != 0 && !lfs[s] ) {
	lfs[s] = 1;
	s = P[s];
    }
}

int main( void ) {
    int N, M;
    scanf("%i %i", &N, &M);

    int i;
    for( i = 1; i <= N; i++ )
	scanf("%i", &t[i]);

    for( i = 1; i <= M; i++ ) {
	int u, v;
	scanf("%i %i", &u, &v);

	E[i].to = v;
	E[i].nextID = LE[u];
	LE[u] = i;
    }

    for( i = 1; i <= N; i++ )
	if( t[i] == 1 ) dfs(i);

    for( i = 1; i <= N; i++ )
	if( t[i] == 2 && afs[i] ) ofs(i);

    for( i = 1; i <= N; i++ )
	printf("%i%c", (afs[i] && lfs[i]) ? 1 : 0, (i == N) ? '\n' : ' ');

    return 0;
}


#include<stdio.h>

int main()
{
    int a,i,j,k,flag,count=0;
    scanf("%d",&a);
    char arr[a][a],oth[a][a],change[a][a],matha_nosto[a][a];
    for(i=0; i<a; i++)
    {
        for(j=0; j<a; j++)
            scanf(" %c",&arr[i][j]);
    }

    for(i=0; i<a; i++)
    {
        for(j=0; j<a; j++)
            scanf(" %c",&oth[i][j]);
    }

    for(i=0; i<a; i++)
    {
        for(j=0; j<a; j++)
            change[j][a-1-i]=oth[i][j];
    }
    for(k=0; k<a+6; k++)
    {
        for(i=0; i<a; i++)
        {
            for(j=0; j<a; j++)
            {
                if(arr[i][j]==change[i][j])
                    flag=1;
                else
                {
                    flag=0;
                    break;
                }
            }
            if(flag==0)
                break;
        }
        if(flag==1)
        {
            printf("YES");
            return 0;
        }
        else
        {
            for(i=0; i<a; i++)
            {
                for(j=0; j<a; j++)
                {
                    if(arr[i][j]==change[i][a-1-j])
                        flag=1;
                    else
                    {
                        flag=0;
                        break;
                    }
                }
                if(flag==0)
                    break;
            }
            if(flag==1)
            {
                printf("YES");
                return 0;
            }
            else
            {
                for(i=0; i<a; i++)
                {
                    for(j=0; j<a; j++)
                        oth[i][j]=change[i][j];
                }

                for(i=0; i<a; i++)
                {
                    for(j=0; j<a; j++)
                        change[j][a-1-i]=oth[i][j];
                }
            }
        }

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

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
char a[20][11],b[20][11];
int n;
int check()
{
    int k=0;
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<n; j++)
        {
            if (a[n+i][j]!=b[i][j])
            {
                k=1;
                break;
            }
        }
    }
    if (k==0)
    {
        printf("YES");
        return 10;
    }
    else
        return 0;
}
void ud()
{
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<n; j++)
        {
            b[n-i-1][j]=a[i][j];
        }
    }
}
void lr()
{
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<n; j++)
        {
            b[i][n-j-1]=a[i][j];
        }
    }
}
void rot()
{
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<n; j++)
        {
            b[n-j-1][i]=a[i][j];
        }
    }
}
void match()
{
    for (int i=0; i<n; i++)
    {
        for (int j=0; j<n; j++)
        {
            a[i][j]=b[i][j];
        }
    }
}
int main()
{
    scanf("%d",&n);
    for (int i=0; i<n*2; i++)
    {
        scanf("%s",a[i]);
    }
    for (int i=0; i<4; i++)
    {
        rot();
        match();
        if (check()==10)
            return 0;
        ud();
        match();
        if (check()==10)
            return 0;
        lr();
        match();
        if (check()==10)
            return 0;
        ud();
        match();
        if (check()==10)
            return 0;
        lr();
        match();
        if (check()==10)
            return 0;
    }
    printf("NO");
    return 0;
}