import math



N = int(eval(input()))



ans = 0

for i in range(1, int(math.sqrt(N)) + 1):

  if i > N / 2:

    continue

  tmp = int((N - i) / i)

  if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):

    ans += tmp



print(ans)
N = int(eval(input()))



def make_divisors(n):

  divisors = []

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

    if n % i == 0:

      divisors.append(i)

      if i != n // i:

        divisors.append(n // i)

  return divisors



div = make_divisors(N)

ans = 0

for d in div:

  if d != 1 and N // (d - 1) == N % (d - 1):

    ans += d - 1



print(ans)
import math

N = int(eval(input()))
ans = 0
for i in range(1, int(math.sqrt(N)) + 1):
    if i > N / 2:
        continue
    tmp = int((N - i) / i)
    if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N):
        ans += tmp
print(ans)

N = int(eval(input()))


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


div = make_divisors(N)
ans = 0
for d in div:
    if d != 1 and N // (d - 1) == N % (d - 1):
        ans += d - 1
print(ans)

-import math +N = int(eval(input())) -N = int(eval(input())) + +def make_divisors(n): +    divisors = [] +    for i in range(1, int(n**0.5) + 1): +        if n % i == 0: +            divisors.append(i) +            if i != n // i: +                divisors.append(n // i) +    return divisors + + +div = make_divisors(N) -for i in range(1, int(math.sqrt(N)) + 1): -    if i > N / 2: -        continue -    tmp = int((N - i) / i) -    if (N - i) % i == 0 and N % tmp != 0 and tmp >= math.sqrt(N): -        ans += tmp +for d in div: +    if d != 1 and N // (d - 1) == N % (d - 1): +        ans += d - 1