var
s,i,j:integer;
begin
for i:=1 to 10000 do
begin
s:=0;
for j:=1 to i-1 do
if (i mod j)=0 then s:=s+j;
if s=i then write(i:5);
end;
end.
var
ans,i,j:integer;
begin
for i:=1 to 10000 do begin
ans:=0;
for j:=1 to i-1 do
if i mod j=0 then s:=s+j;
if s=i then writeln(i);
end;
end.