N = int(eval(input()))

cnt = 0

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

    if N%i==0:

        q = N//i

        m = i-1

        if q<m:

            cnt += m

        m = N//i-1

        q = i

        if q<m:

            cnt += m

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
for i in range(1, int(N**0.5) + 1):
    if N % i == 0:
        q = N // i
        m = i - 1
        if q < m:
            cnt += m
        m = N // i - 1
        q = i
        if q < m:
            cnt += m
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)))

-cnt = 0 +A = [] -        q = N // i -        m = i - 1 -        if q < m: -            cnt += m -        m = N // i - 1 -        q = i -        if q < m: -            cnt += m -print(cnt) +        a = i +        b = N // i +        if a > b: +            a, b = b, a +        if 0 < a < b - 1: +            A.append(b - 1) +print((sum(A)))