r = []
for i in range(1, 1001):
s = 0
for j in range(1, i-1):
if i%j==0:
s+=j
if s==i:
r+=[str(i)]
print("Совершенные числа:",", ".join(r), end=".")
r = []
for i in range(1, 1001):
s = 0
for j in range(1, i-1):
if i%j==0:
s+=j
if s==i:
r+=[str(i)]
print("Совершенные числа:",", ".join(r), end=".")