uses crt;
var a,b,i,n:longint;
function nt(a:longint):boolean;
var i:longint;
begin
i:=2;
while(a>1)and(a mod i<>0)do inc(i);
nt:=i=a;
end;
function snt(a:longint):boolean;
begin
while nt(a) do
a:=a div 10;
if a<>0 then exit(false) else exit(true);
end;
begin
clrscr;
write('Nhap so n: ');readln(n);
a:=1;
for i:=1 to n-1 do a:=a*10;
b:=a*10-1;
for i:=a to b do
if snt(i) then writeln(i);
readln
end.