n = int(eval(input()))



ans = 0

i = 1



while i*(i+1)+i <= n:

    if (n-i) % i == 0:

        ans += (n-i)//i

    i += 1



print(ans)

n = int(eval(input()))



divisors = set()



for i in range(1, int(n**0.5)+1):

    if n % i == 0:

        divisors.add(i)

        divisors.add(n//i)



ans = 0



for d in divisors:

    m = d-1

    if m != 0 and n//m == n % m:

        ans += m



print(ans)

n = int(eval(input()))
ans = 0
i = 1
while i * (i + 1) + i <= n:
    if (n - i) % i == 0:
        ans += (n - i) // i
    i += 1
print(ans)

n = int(eval(input()))
divisors = set()
for i in range(1, int(n**0.5) + 1):
    if n % i == 0:
        divisors.add(i)
        divisors.add(n // i)
ans = 0
for d in divisors:
    m = d - 1
    if m != 0 and n // m == n % m:
        ans += m
print(ans)

+divisors = set() +for i in range(1, int(n**0.5) + 1): +    if n % i == 0: +        divisors.add(i) +        divisors.add(n // i) -i = 1 -while i * (i + 1) + i <= n: -    if (n - i) % i == 0: -        ans += (n - i) // i -    i += 1 +for d in divisors: +    m = d - 1 +    if m != 0 and n // m == n % m: +        ans += m