var a:integer;
begin
a:=100;
while (a mod 10 * a mod 10 * a mod 10 <> a) and (sqr(a div 100 + (a div 10 mod 10) * 10)<>a) do a:=a+1;
writeln(a);
end.
var a:integer;
begin
a:=100;
while (a mod 10 * a mod 10 * a mod 10 <> a) and (sqr(a div 100 + (a div 10 mod 10) * 10)<>a) do a:=a+1;
writeln(a);
end.