public class Main {
public static void main(String[] args) {
java.util.Scanner input = new java.util.Scanner(System.in) ;
while (input.hasNextInt()) {
String str = input.nextLine();
int a = str.length();
int number1 = 0;
int number2 = 0;
int b =a-1;
for (int i=0;i<a;i++) {
char c =str.charAt(i);
int d = c-48;
number1 += d*Math.pow(10.0,b);
b--;
}
int d = a-1;
for(int i = 0;i<a;i++) {
number2 += 9*Math.pow(10,d);
d--;
}
if(number1==number2) {
int e = (int)Math.pow(10,a)*1 +1;
System.out.println(e);
}
else {
if (a % 2 != 0){
int n = 0,m=0;
int o = 0;
for(int j=0;j<a/2;j++){
n += (str.charAt(j)-48)*Math.pow(10,o);
o++;
}
int l = a/2-1;
for(int j = a/2+1;j<a;j++) {
m +=(str.charAt(j) - 48)*Math.pow(10,l);
l--;
}
int number3 = 0;
b =a-1;
for(int i = 0;i<=a/2;i++) {
number3+=(str.charAt(i)-48)*Math.pow(10,b);
b--;
}
int k = 0;
for(int i= 0;i<a/2;i++){
number3+=(str.charAt(i)-48)*Math.pow(10,k);
k++;
}
if(n>m) {
System.out.println(number3);
}
else{
number3=number3+(int)Math.pow(10,a/2);
System.out.println(number3);
}
}
if(a%2==0) {
int n = 0,m=0;
int o = 0;
for(int j=0;j<a/2;j++){
n += (str.charAt(j)-48)*Math.pow(10,o);
o++;
}
int l = a/2-1;
for(int j = a/2;j<a;j++) {
m +=(str.charAt(j) - 48)*Math.pow(10,l);
l--;
}
int number3 = 0;
b =a-1;
for(int i = 0;i<a/2;i++) {
number3+=(str.charAt(i)-48)*Math.pow(10,b);
b--;
}
int k = 0;
for(int i= 0;i<a/2;i++){
number3+=(str.charAt(i)-48)*Math.pow(10,k);
k++;
}
if(n>m) {
System.out.println(number3);
}
else{ int v = a/2;
for(int f = 0;f<=1;f++){
number3+=1*Math.pow(10,v);
v--;
}
System.out.println(number3);
}
}
}
}
}
}
/**************************************************************
Problem: 2094
User: admin
Language: Java
Result: Accepted
Time:2494 ms
Memory:40372 kb
****************************************************************/