import math ip = int(input()) sum = 0 for i in range(1, ip): if (ip % i == 0): sum += i print(sum)