N = int(input())
if N % 2 == 0:
    N //= 2

div = set()
for i in range(1, int(N ** 0.5) + 1):
    if N % i == 0:
        div.add(i)
        div.add(N // i)

print(sum(div))