var n:integer;
    b:boolean;

begin
 writeln('--------------------');
 readln(n);
 b:=b<b;
 while n>0 do
  begin
   if n mod 10=0 then b:=true;
   n:=n div 10;
  end;
 if b then writeln(n) else writeln('317');
end.