#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(h>i){
		j=a;
	}else j=i+h*1000;
	cout<<j;	
}
/**************************************************************
	Problem: 1631
	User: toughuatao1
	Language: C++
	Result: Wrong Answer
****************************************************************/