uses crt;
var i,a,b: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 tong(a:longint):longint;
begin
tong:=0;
repeat
inc(tong,a mod 10);
a:=a div 10;
until a=0;
end;
begin
clrscr;
readln(a,b);
for i:=a to b do
if (nt(i))and(nt(tong(i))) then write(i,' ');
readln
end.