int main()
{
	int n,m,k=0;
	for(k=1;k<7;k++)
	{
	scanf("%d\n",&n);
	m=reverse(n);
	printf("%d\n",m);
	}
	return 0;
}
int reverse(int num)
{
	int t,num1,a,b,c,d,e,f,g,h,i,j;
	if(num<0) num1=-num;
	else num1=num;

	if(10000000000>num1&&num1>999999999)
	{
		 a=num1/1000000000;
		 b=(num1-1000000000*a)/100000000;
		 c=(num1-1000000000*a-100000000*b)/10000000;
	     d=(num1-1000000000*a-100000000*b-10000000*c)/1000000;
		 e=(num1-1000000000*a-100000000*b-10000000*c-1000000*d)/100000;
		 f=(num1-1000000000*a-100000000*b-10000000*c-1000000*d-100000*e)/10000;
		 g=(num1-1000000000*a-100000000*b-10000000*c-1000000*d-100000*e-10000*f)/1000;
		 h=(num1-1000000000*a-100000000*b-10000000*c-1000000*d-100000*e-10000*f-1000*g)/100;
		 i=(num1-1000000000*a-100000000*b-10000000*c-1000000*d-100000*e-10000*f-1000*g-100*h)/10;
		 j= num1-1000000000*a-100000000*b-10000000*c-1000000*d-100000*e-10000*f-1000*g-100*h-10*i;

		t=1000000000*j+100000000*i+10000000*h+1000000*g+100000*f+10000*e+1000*d+100*c+10*b+a;
	}

	if(1000000000>num1&&num1>99999999)
	{
		 a=num1/100000000;
		 b=(num1-100000000*a)/10000000;
		 c=(num1-100000000*a-10000000*b)/1000000;
		 d=(num1-100000000*a-10000000*b-1000000*c)/100000;
		 e=(num1-100000000*a-10000000*b-1000000*c-100000*d)/10000;
		 f=(num1-100000000*a-10000000*b-1000000*c-100000*d-10000*e)/1000;
		 g=(num1-100000000*a-10000000*b-1000000*c-100000*d-10000*e-1000*f)/100;
		 h=(num1-100000000*a-10000000*b-1000000*c-100000*d-10000*e-1000*f-100*g)/10;
		 i= num1-100000000*a-10000000*b-1000000*c-100000*d-10000*e-1000*f-100*g-10*h;

		t=100000000*i+10000000*h+1000000*g+100000*f+10000*e+1000*d+100*c+10*b+a;
	}

	if(100000000>num1&&num1>9999999)
	{
		 a=num1/10000000;
		 b=(num1-10000000*a)/1000000;
		 c=(num1-10000000*a-1000000*b)/100000;
		 d=(num1-10000000*a-1000000*b-100000*c)/10000;
		 e=(num1-10000000*a-1000000*b-100000*c-10000*d)/1000;
		 f=(num1-10000000*a-1000000*b-100000*c-10000*d-1000*e)/100;
		 g=(num1-10000000*a-1000000*b-100000*c-10000*d-1000*e-100*f)/10;
		 h= num1-10000000*a-1000000*b-100000*c-10000*d-1000*e-100*f-10*g;

		t=10000000*h+1000000*g+100000*f+10000*e+1000*d+100*c+10*b+a;
	}

	if(10000000>num1&&num1>999999)
	{
		 a=num1/1000000;
		 b=(num1-1000000*a)/100000;
		 c=(num1-1000000*a-100000*b)/10000;
		 d=(num1-1000000*a-100000*b-10000*c)/1000;
		 e=(num1-1000000*a-100000*b-10000*c-1000*d)/100;
		 f=(num1-1000000*a-100000*b-10000*c-1000*d-100*e)/10;
		 g= num1-1000000*a-100000*b-10000*c-1000*d-100*e-10*f;

		t=1000000*g+100000*f+10000*e+1000*d+100*c+10*b+a;
	}

	if(1000000>num1&&num1>99999)
	{
		 a=num1/100000;
		 b=(num1-100000*a)/10000;
		 c=(num1-100000*a-10000*b)/1000;
		 d=(num1-100000*a-10000*b-1000*c)/100;
		 e=(num1-100000*a-10000*b-1000*c-100*d)/10;
		 f=(num1-100000*a-10000*b-1000*c-100*d-10*e)/10;

		t=100000*f+10000*e+1000*d+100*c+10*b+a;
	}

	if(100000>num1&&num1>9999)
	{
		 a=num1/10000;
		 b=(num1-10000*a)/1000;
		 c=(num1-10000*a-1000*b)/100;
		 d=(num1-10000*a-1000*b-100*c)/10;
		 e=num1-10000*a-1000*b-100*c-10*d;
	
			t=10000*e+1000*d+100*c+10*b+a;
	}

	if(10000>num1&&num1>999)
	{
		 a=num1/1000;
		 b=(num1-1000*a)/100;
		 c=(num1-1000*a-100*b)/10;
		 d=num1-1000*a-100*b-10*c;
			
		t=1000*d+100*c+10*b+a;
	}
	
	if(1000>num1&&num1>99)
	{
		 a=num1/100;
		 b=(num1-100*a)/10;
		 c=num1-100*a-10*b;
		
		t=100*c+10*b+a;
	}

		if(100>num1&&num1>9)
	{
		 a=num1/10;
		 b=num1-10*a;

		t=10*b+a;
	}

		if(10>num1&&num1>=0)
			t=num1;

		if(num<0) t=-t;
		else t=t;
		return t;
}