Program HOC24;
var m,n,i,d: integer;
t: longint;
function nt(x: integer): boolean;
var j: integer;
begin
nt:=true;
if (x=2) or (x=3) then exit;
nt:=false;
if (x=1) or (x mod 2=0) or (x mod 3=0) then exit;
j:=5;
while j<=trunc(sqrt(x)) do
begin
if (x mod j=0) or (x mod (j+2)=0) then exit;
j:=j+6;
end;
nt:=true;
end;
begin
write('Nhap m: '); readln(m);
write('Nhap n: '); Readln(n);
d:=0; i:=2;
while d<n do
begin
if nt(i) and (i>m) then
begin
d:=d+1;
t:=t+i;
end;
i:=i+1;
end;
write('Ket qua: ',t);
readln
end.