N = int(eval(input()))

A = []

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

    if N%i==0:

        a = i

        b = N//i

        if a>b:

            a,b = b,a

        if 0<a<b-1:

            A.append(b-1)

print((sum(A)))
N = int(eval(input()))

cnt = 0

if N>2:

    for x in range(2,int(N**0.5)+1):

        if N%x==0:

            y = N//x

            if N//(x-1)==N%(x-1):

                cnt += x-1

            if N//(y-1)==N%(y-1):

                cnt += y-1

    cnt += N-1

print(cnt)
N = int(eval(input()))
A = []
for i in range(1, int(N**0.5) + 1):
    if N % i == 0:
        a = i
        b = N // i
        if a > b:
            a, b = b, a
        if 0 < a < b - 1:
            A.append(b - 1)
print((sum(A)))

N = int(eval(input()))
cnt = 0
if N > 2:
    for x in range(2, int(N**0.5) + 1):
        if N % x == 0:
            y = N // x
            if N // (x - 1) == N % (x - 1):
                cnt += x - 1
            if N // (y - 1) == N % (y - 1):
                cnt += y - 1
    cnt += N - 1
print(cnt)

-A = [] -for i in range(1, int(N**0.5) + 1): -    if N % i == 0: -        a = i -        b = N // i -        if a > b: -            a, b = b, a -        if 0 < a < b - 1: -            A.append(b - 1) -print((sum(A))) +cnt = 0 +if N > 2: +    for x in range(2, int(N**0.5) + 1): +        if N % x == 0: +            y = N // x +            if N // (x - 1) == N % (x - 1): +                cnt += x - 1 +            if N // (y - 1) == N % (y - 1): +                cnt += y - 1 +    cnt += N - 1 +print(cnt)