#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,d,e,f,g,h,i,j;
cin>>a;
b=a%10;
c=a/10%10;
d=a/100%10;
e=a/1000%10;
f=a/10000%10;
g=a/100000%10;
h=b+c*10+d*100;
i=e+f*10+g*100;
if(i>h){
j=a;
}else{
j=e+f*10+g*100+d*1000+c*10000+b*100000;
}
cout<<j;
}
/**************************************************************
Problem: 1631
User: toughuatao1
Language: C++
Result: Wrong Answer
****************************************************************/