N=int(eval(input()))

ans = 0

for r in range(1,int(N**(0.5))+10):

    if (N-r)%r==0:

        m = (N-r)//r

        if m!=0 and r == N//m:

            ans += m

print(ans)
def get_divisor(n):

    a,b = [],[]

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

        if n%i==0:

            a.append(i)

            b.append(n//i)

    if a[-1]==b[-1]:b.pop()

    a.extend(b[::-1])

    return a



N = int(eval(input()))

ans = 0

for m in get_divisor(N):

    m-=1

    if m==0 : continue

    if N//m == N%m: ans+=m

print(ans)
N = int(eval(input()))
ans = 0
for r in range(1, int(N ** (0.5)) + 10):
    if (N - r) % r == 0:
        m = (N - r) // r
        if m != 0 and r == N // m:
            ans += m
print(ans)

def get_divisor(n):
    a, b = [], []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            a.append(i)
            b.append(n // i)
    if a[-1] == b[-1]:
        b.pop()
    a.extend(b[::-1])
    return a


N = int(eval(input()))
ans = 0
for m in get_divisor(N):
    m -= 1
    if m == 0:
        continue
    if N // m == N % m:
        ans += m
print(ans)

+def get_divisor(n): +    a, b = [], [] +    for i in range(1, int(n**0.5) + 1): +        if n % i == 0: +            a.append(i) +            b.append(n // i) +    if a[-1] == b[-1]: +        b.pop() +    a.extend(b[::-1]) +    return a + + -for r in range(1, int(N ** (0.5)) + 10): -    if (N - r) % r == 0: -        m = (N - r) // r -        if m != 0 and r == N // m: -            ans += m +for m in get_divisor(N): +    m -= 1 +    if m == 0: +        continue +    if N // m == N % m: +        ans += m