ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1123. Зарплата

No subject
Послано Roman Furko 19 сен 2010 11:15
Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.Var  s,s1,s2:string;
     oK:boolean;
     n,i,j:longint;
     q : char;

function max (x,y:longint):longint;
 begin
  if y>x then x := y;
  max := x;
 end;

function suma (s2,s3:string):string;
 var a,b,c:array[0..1000]of longint;
     i,j,t,p,x:longint;
     hh,ss : string;
  begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   fillchar(c,sizeof(c),0);

   for i:=1 to length(S2) do
    val(s2[i],a[length(S2)-i+1],p);

   for i:=1 to length(S3) do
    val(s3[i],b[length(S3)-i+1],p);

   t := max(length(S2),length(S3));

   x := 0;
   for i:=1 to t do
    begin
     x := x + a[i] + b[i];
     c[i] := x mod 10;
     x := x div 10;
    end;
   hh := '';
   for i:=t downto 1 do
    begin
     str(c[i],ss);
     hh := hh + ss;
    end;
   suma := hh;
  end;
 begin
  readln(s);
  if length(S) = 1 then begin
                         writeln('11');
                         halt(0);
                        end;
  n := length(S);
  ok := false;
  if n mod 2 <> 0 then begin
                        ok := true;
                        q := s[n div 2 + 1];
                        dec(n);
                       end;
  s1 := '';
  for i:=1 to n div 2 do
   s1 := s1 + s[i];
  s2 := s1;
  if ok then s2 := s2 +q;
  for i:=n div 2 downto 1 do
   s2 := s2 + s1[i];
  if s2 >= s then writeln(s2)
  else begin
        s1 := suma(s1,'1');
        s2 := s1;
        if ok then s2 := s2 + '0';
        for i:=n div 2 downto 1 do
         s2 := s2 + s1[i];
        writeln(s2);
       end;
 end.

Edited by author 19.09.2010 11:16
Re: No subject
Послано shalamov.ivan 25 фев 2018 01:46
WTF it is?