#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n,m,temp0,temp1=0;
int b=0,a=1,c=0;
cin>>n;
if(n>=0)
{
m=n;
temp0=0;
}
else
{
m=-n;
temp0=1;
}
for(int i=0;i<=30;i++)
{
a=pow(10,i);
b=m/a;
if(b<=1)
{
c=i;
break;
}
}
for(int j=1;j<=c;j++)
{
int d,e,f,g;
f=c-j;
e=pow(10,f);
g=pow(10,j-1);
d=m/e;
temp1=temp1+d*g;
m=m-d*pow(10,f);
}
if(temp0==0)
cout<<temp1;
if(temp0==1)
cout<<-temp1;
}