Function del(a:integer):boolean; var k:integer; begin del:=true; k:=a; while(k<>0) do begin if(k mod 10 = 0) then begin del:=false; break; end else if(a mod (k mod 10) <> 0) then del:=false; k:=k div 10; end; end;
var i,n:integer; begin read(n); for i:=1 to n do if(del(i)) then write(i,' '); end.
var k:integer;
begin
del:=true;
k:=a;
while(k<>0) do begin
if(k mod 10 = 0) then begin del:=false; break; end
else if(a mod (k mod 10) <> 0) then del:=false;
k:=k div 10;
end;
end;
var i,n:integer;
begin
read(n);
for i:=1 to n do
if(del(i)) then write(i,' ');
end.