CodeEff/ECCO huggingface dataset:
# Original solution
X=int(eval(input()))
place=[]
time=1
place.append(0)
while True:
	next=[]
	for i in place:
		if i+time not in place:
			next.append(i+time)
		if i-time not in place:
			next.append(i+time)
	if X in next:
		break
	time+=1
	place.extend(next)
print(time)

# Optimized solution
X=int(eval(input()))
place=0
time=0
while place<X:
	time+=1
	place+=time
print(time)
# Original solution
str = eval(input())
x = int(str)

res = 1
s = 0
for i in range(1, 10 ** 5):
  s = s + i
  if s >= x:
    res = i
    break

print(res)



# Optimized solution
import math

str = eval(input())
x = int(str)

res = math.ceil((-1 + math.sqrt(1 + 8 * x)) / 2.0)

print(res)
# Original solution
X = int(eval(input()))

for n in range(1000000):
    # print((n * (n - 1) // 2))
    if (n * (n - 1) // 2) >= X:
        break
print((n - 1))


# Optimized solution

X = int(eval(input()))

# for n in range(1000000):
#     # print((n * (n - 1) // 2))
#     if (n * (n - 1) // 2) >= X:
#         break


# n^2 - n - 2X <= 0
# n = (1 + sqrt(1 + 8X)) // 2
n = max(int((1 + (1 + 8 * X) ** 0.5) / 2) - 1, 0)
while True:
    if (n * (n - 1) // 2) >= X:
        break
    n += 1
print((n - 1))
# Original solution
X=int(eval(input()))
i=0
d=0
while d<X:
    i+=1
    d=i*(i+1)//2

print(i)

# Optimized solution
X=int(eval(input()))
d=0
for i in range(1,X+1):
    d+=i
    if d>=X:
        print(i)
        exit()
# Original solution
n=int(eval(input()))
p=0
for i in range(1,int(n**0.5)+2):
    j,k=divmod(n-i,i)
    p+=0 if k or j<=i else j
print(p)

# Optimized solution
n=int(eval(input()))
p=0
for i in range(1,int(n**0.5)+10):
    if n%i==0 and n//i-1>i:
        p+=n//i-1
print(p)
# Original solution
N = int(eval(input()))
ans = 0
for i in range(1,N):
    if N % i == 0:
        temp = N // i - 1
        d,m = divmod(N,temp)
        if d != m:
            break
        else:
            ans += temp
print(ans)

# Optimized solution
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

N = int(eval(input()))
divisors = make_divisors(N)
ans = 0
divisors.sort(reverse=True)
for x in divisors:
    if x > 1:
        temp = x - 1
        d,m = divmod(N,temp)
        if d != m:
            break
        else:
            ans += temp
print(ans)
# Original solution
n = int(eval(input()))
ans = 0
for i in range(1, int((n + 1)**0.5)):
    if n % i == 0:
        ans += n // i - 1
print(ans)


# Optimized solution
n=int(eval(input()))
print((sum(n//i-1 for i in range(1,int((n+1)**0.5)) if n%i<1)))
# Original solution
N = int(eval(input()))

ans = 0

for i in range(1, N + 1):
    x =  (N - i) // i
    if x <= i:
        break
    if (N - i) % i == 0:
        ans += x

print(ans)





# Optimized solution
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)

    # divisors.sort()
    return divisors

divs = make_divisors(N)

ans = 0

for d in divs:
    if d == 1:
        continue
    m = d - 1
    if N // m == N % m:
        ans += m

print(ans)
# Original solution
# N//m=N%m
# (N-N%m)/m=N%m
# N=(N%m)(m+1)

n=int(eval(input()))

def make_divisor(x):
    ret=[]
    for i in range(1,int(x**.5)+1):
        q,m=divmod(x,i)
        if m==0:
            ret.append(i)
            if i==q:continue
            ret.append(q)
    return ret

ans=[]
d=make_divisor(n)

for e in d:
    if e==1:continue
    m=e-1
    k=n%m
    if k*e==n:
        ans.append(m)
print((sum(ans)))

# Optimized solution
# N//m==N%m=k
# N=k*m+k=k(m+1)=kM
N=int(eval(input()))
arr=[]
for i in range(1,int(N**0.5)+1):
    if N%i==0:
        arr.append(N//i)
        if N//i!=i:
            arr.append(i)
arr.sort()

ans=0
for M in arr:
    m=M-1
    if m==0:continue
    if N%m==N//m:
        ans+=m
print(ans)
# Original solution
n = int(eval(input()))
i = 1
ans = 0
while 1:
    if (n-i)%i == 0 :
        if ((n-i)//i) > i:
            ans += (n-i)//i
        else:
            break
    i += 1
print(ans)

# Optimized solution
n = int(eval(input()))
i = 1
ans = 0
r = int(n**(1/2))
for i in range(1,r+1):
    if (n-i)%i == 0:
        if ((n-i)//i) > i:
            ans += (n-i)//i
        else:
            break
print(ans)
# Original solution
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)

    #divisors.sort(reverse=True)
    return divisors

d = make_divisors(n)
ans = 0
for a in d:
    if a == 1:
        continue
    else:
        q = n//a
        m = a-1
        if 0 <= q <= m-1:
            ans += m
print(ans)


# Optimized solution
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)

    #divisors.sort(reverse=True)
    return divisors

D = make_divisors(n)
ans = 0
for d in D:
    m = d-1
    q = n//d
    if m > 0 and 0 <= q < m:
        ans += m
print(ans)
# Original solution
n=int(eval(input()))
if n==2:
    print((0))
    exit()
ans=n-1
for i in range(int(n**0.5)+1,2,-1):
    # print(n//i+1)
    l,r=n//i+1,n//(i-1)+1
    while l+1<r:
        mid=(l+r)//2
        if n//mid<=n%mid:
            l=mid
        else:
            r=mid
    if n//l==n%l:
        ans+=l
print(ans)


# Optimized solution
n=int(eval(input()))
ans=0
for i in range(1,int(n**0.5)+1):
    if n%i==0:
        if i>1 and n//(i-1)==n%(i-1):
            ans+=i-1
        if n//i!=i:
            if n//(n//i-1)==n%(n//i-1):
                ans+=n//i-1
print(ans)
# Original solution
def solve(N):
    s = 1
    e = int(pow(N, 0.5)) + 1
    ds = []
    for i in range(s, e):
        if N % i == 0:
            m = (N // i) - 1
            if m and N // m == N % m:
                ds.append(N // i)
                # print(f"{N} = {m} * {N // m} + {N % m}")

    return sum([i - 1 for i in ds])


assert (solve(8) == 3 + 7)
assert (solve(10) == 4 + 9)
assert (solve(1000000000000) == 2499686339916)
if __name__ == "__main__":
    N = int(eval(input()))
    print((solve(N)))


# Optimized solution
def solve(N):
    s = 1
    e = int(pow(N, 0.5)) + 1
    ds = []
    for i in range(s, e):
        if N % i == 0:
            m = (N // i) - 1
            if m and N // m == N % m:
                ds.append(N // i)

    return sum([i - 1 for i in ds])

if __name__ == "__main__":
    N = int(eval(input()))
    print((solve(N)))
# Original solution
N = int(eval(input()))

ans = 0
for r in range(1,N+1):
  if (N-r)%r != 0:
    continue
  else:
    m = (N-r)//r
    if m <= r:
      break
    else:
      ans += m
      
print(ans)

# Optimized solution
N = int(eval(input()))

ans = 0
for r in range(1,int(N**0.5)+2):
  if (N-r)%r != 0:
    continue
  else:
    m = (N-r)//r
    if m <= r:
      break
    else:
      ans += m
      
print(ans)
# Original solution
n = int(eval(input()))

ans = 0
i = 1

while i*(i+1)+i <= n:
    if (n-i) % i == 0:
        ans += (n-i)//i
    i += 1

print(ans)


# Optimized solution
n = int(eval(input()))

divisors = set()

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

ans = 0

for d in divisors:
    m = d-1
    if m != 0 and n//m == n % m:
        ans += m

print(ans)
# Original solution
import math
from collections import defaultdict
from itertools import product
from functools import reduce 
from operator import mul


def is_prime(num):
    if not isinstance(num, int):
        return False
    if num <= 1:
        return False
    if num == 2 or num == 3:
        return True
    if num % 6 in [0, 2, 3, 4]:
        return False
    div_max = int(math.sqrt(num))
    for div in range(5, div_max + 1, 2):
        if num % div == 0:
            return False
    return True

def factorint(x):
    factors = defaultdict(int)
    while not is_prime(x):
        div_max = int(math.sqrt(x))
        for div in range(2, div_max + 1):
            if x % div == 0:
                factors[div] += 1
                x = int(x / div)
                break
    factors[x] += 1
    return factors

ans = 0
n = int(eval(input()))
if n==0:
    print((0))
    exit()
rn = math.sqrt(n+1) + 1
factor_dict = factorint(n)
ks = [list(range(k+1)) for k in list(factor_dict.values())]
prs = product(*ks)
for pr in prs:
    s = reduce(mul, [factor**p for factor,p in zip(list(factor_dict.keys()), pr)])
    if s >= rn:
        ans += s -1
print(ans)


# Optimized solution
import math
from collections import defaultdict
from itertools import product
from functools import reduce 
from operator import mul


def is_prime(num):
    if not isinstance(num, int):
        return False
    if num <= 1:
        return False
    if num == 2 or num == 3:
        return True
    if num % 6 in [0, 2, 3, 4]:
        return False
    div_max = int(math.sqrt(num))
    for div in range(5, div_max + 1, 2):
        if num % div == 0:
            return False
    return True

def factorint(x):
    factors = defaultdict(int)
    if x==1:
        factors[1] = 1
        return factors
    while not is_prime(x):
        div_max = int(math.sqrt(x))
        for div in range(2, div_max + 1):
            if x % div == 0:
                factors[div] += 1
                x = int(x / div)
                break
    factors[x] += 1
    return factors

ans = 0
n = int(eval(input()))
rn = math.sqrt(n+1) + 1
factor_dict = factorint(n)
ks = [list(range(k+1)) for k in list(factor_dict.values())]
prs = product(*ks)
for pr in prs:
    s = reduce(mul, [factor**p for factor,p in zip(list(factor_dict.keys()), pr)])
    if s >= rn:
        ans += s -1
print(ans)
# Original solution
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)

# Optimized solution
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)
# Original solution
n=int(eval(input()))

ans = 0

for i in range(1,int(n**0.5)+2):
    if n%i == 0 and n//i>=i+2:
        ans += (n//i)-1
print(ans)

# Optimized solution
def prime(p):
    memo = [p]
    for i in range(2,(int(p**0.5)+1)):
        if p%i == 0:
            memo.append(i)
            memo.append(p//i)
    return memo

x = int(eval(input()))

if x== 1:
    print((0))
    exit()

memo = prime(x)

ans = 0

for i in memo:
    if x%(i-1)==x//(i-1):
        ans += i-1
print(ans)
# Original solution
n = int(eval(input()))

result = 0
for i in range(1, int(n**(1/2)+1)):
    if n%i==0:
        x = n//i -1
        if x > i:
            result += x
print(result)

# Optimized solution
n = int(eval(input()))
print((sum([n//i-1 for i in range(1, int(n**(1/2))+1) if (n%i==0) and (n//i-1 > i)])))
# Original solution
n = int(eval(input()))
print((sum([n//i-1 for i in range(1, int(n**(1/2))+1) if n%i==0 and n//i-1>i])))

# Optimized solution
n=int(eval(input()))
print((sum(n//i-1 for i in range(1, int(n**(1/2))+1) if n%i==0 and n//i-1>i)))
# Original solution
import math

n = int(eval(input()))
ans = 0
for i in range(1, int(-(-n**0.5//1))+1):
    if n%i == 0:
        m = n//i - 1
        if i < m: ans += m 
print(ans)

# Optimized solution
n=int(eval(input()))  
ans = 0
for i in range(1,int(n**0.5)+1):
    if n%i == 0:
        # print('----',i)
        a = i
        x1 = n//i
        x = x1-1
        # print(a,x)
        if a < x:
            ans += x
        
        a = n//i
        x1 = i
        x = x1 - 1
        if a < x:
            ans += x

print(ans)
# Original solution
from collections import defaultdict

def prime_factorization(n):
    '''
    Trial division.
    Input: 
        n : a positive integer
    Output:
        a dictionary of #(each prime factors) of n,
    '''
    result = defaultdict(int)
    if n < 2:
        return result
    while n % 2 == 0:
        result[2] += 1
        n //= 2
    p = 3
    while p*p <= n:
        while n % p == 0:
            n //= p
            result[p] += 1
        p += 2
    if n > 1:
        result[n] += 1
    return result

N = int(eval(input()))
ans = 0
if N >= 2:
    p = 1
    while p*p <= N:
        q, r = divmod(N, p)
        if r == 0 and p < q - 1:
            ans += q - 1
        p += 1
print(ans)

# Optimized solution
N = int(eval(input()))
ans = 0
if N >= 2:
    p = 1
    while p*p <= N:
        q, r = divmod(N, p)
        if r == 0 and p < q - 1:
            ans += q - 1
        p += 1
print(ans)
# Original solution
N = int(eval(input()))
ans = 0
if N <= 2:
    print((0))
    exit()
for i in range(1, 10**7):
    if (N - i) % i == 0:
        tmp = (N - i) // i
        if tmp > 1 and tmp > i:
            ans += tmp
print(ans)


# Optimized solution
N = int(eval(input()))
ans = 0
if N <= 2:
    print((0))
    exit()
for i in range(1, 10**6):
    if (N - i) % i == 0:
        tmp = (N - i) // i
        if tmp > 1 and tmp > i:
            ans += tmp
print(ans)
# Original solution
N = int(eval(input()))
 
result = 0
for i in range(1, int(N**0.5)+1):
  if (N - i) % i == 0 and i ** 2 + i < N:
    result += (N - i) // i
      
print((int(result)))

# Optimized solution
import math
N = int(eval(input()))

result = 0
for i in range(1, math.ceil(((1+4*N)**0.5-1)/2)):
  if (N - i) % i == 0:
    result += (N - i) // i
      
print((int(result)))
# Original solution
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)

# Optimized solution
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)
# Original solution
N = int(eval(input()))
ans = sum(
    (N - q) // q
    for q in range(1, int(N**0.5) + 1)
    if (N - q) % q == 0 and N // ((N - q) // q) == N % ((N - q) // q)
) if N >= 2 else 0
print(ans)

# Optimized solution
# 入力
N = int(eval(input()))

# sqrt(N) + 1 より大きい N の約数dについて、 d - 1 がお気に入りの数か
# 判定し、お気に入りの数であるものの和を解とする
ans = sum(
    N // d - 1
    for d in range(1, int(N**0.5) + 1)
    if N % d == 0 and N // d > 1 and (N // (N // d - 1)) == (N % (N // d - 1))
)

# 出力
print(ans)
# Original solution
import math
N=int(eval(input()))
a=int((math.sqrt(N)//1))
ans=0
if N==2:
  print((0))
  exit()
for i in range(1,a):
  b=(N-i)/i
  if b.is_integer():
    ans+=int(b)
c=N//a
d=N%a
if int(c)==d:
  ans+=a
a+=1
c=N//a
d=N%a
if int(c)==d:
  ans+=a
print(ans)

# Optimized solution
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
A=make_divisors(N)
ans=0
for i in A:
  if i==1:
    continue
  a=N//(i-1)
  b=N%(i-1)
  if a==b:
    ans+=(i-1)
print(ans)
# Original solution
N = int(eval(input()))
print((sum((N // n - 1) for n in range(1, int(N ** 0.5) + 1) if not N % n and n < N // n - 1)))

# Optimized solution
N = int(eval(input()))
print((sum(N // n - 1 for n in range(1, int(N ** 0.5) + 1) if not N % n and n < N // n - 1)))
# Original solution
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)

# Optimized solution
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)))
# Original solution
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)))

# Optimized solution
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)
# Original solution
n = int(eval(input()))

###商及び余りをsとすると、n=m*s+s=s(m+1)、ただし0<s<m
sum_fav = 0
for s in range(1,n):
  if n%s == 0:
    m = n//s-1
    if s < m:
      #print(m)
      sum_fav += m
    else:
      break
  
print(sum_fav)


# Optimized solution
import math

n = int(eval(input()))

###商及び余りをsとすると、n=m*s+s=s(m+1)、ただし0<s<m
sum_fav = 0
for s in range(1,int(math.sqrt(n))+1):
  if n%s == 0:
    m = n//s-1
    if s < m:
      #print(m)
      sum_fav += m
    else:
      break
  
print(sum_fav)
# Original solution
import math

N = int(eval(input()))
ms = []

def solve(N):
    result = 0
    ms = [] 
    for m in range(1, N):
        d, r = divmod(N, m)
        if d == r:
            result += m
            ms.append(m)

    return result, ms

def solve1(N):
    s = 0
    ms = [] 
    for m in range(1, int(math.sqrt(N)+1)):
        d, r = divmod(N, m)
        if r == 0:
            if d < m-1:
                s += m - 1
                ms.append(m-1)
            else:
                s += d - 1
                ms.append(d-1)
    return s, ms

s = 0
cs = set()
for m in range(1, int(math.sqrt(N)+1)):
    q, r = divmod(N, m)
    if r != 0:
        continue
    cs.add(q-1)
    cs.add(m-1)

def check(c):
    if c == 0:
        return 0
    return c if N // c == N % c else 0
        
s = sum(check(c) for c in cs)
print(s) 


# Optimized solution
import math

N = int(eval(input()))

cs = set()
for m in range(1, int(math.sqrt(N))+1):
    q, r = divmod(N, m)
    if r != 0:
        continue
    cs.add(q-1)
    cs.add(m-1)

s = sum(c if N // c == N % c else 0 for c in cs if c > 0)
print(s)
# Original solution
N = int(eval(input()))
ans = 0
n = 1
while n*n < N:
    if (N-n)%n == 0:
        m = (N-n)//n
        if m <= n: break
        ans += m
    n += 1
print(ans)

# Optimized solution
N = int(eval(input()))

m = 1
ans = 0
while m*m <= N:
    if (N-m)%m == 0:
        d = (N-m)//m
        if d <= m: break
        ans += d
    m += 1
print(ans)
# Original solution
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)

	divisors.sort(reverse = True)
	return divisors

N = int(eval(input()))
div = make_divisors(N)
i = 0
ans = 0
m = div[0]
while m >= 1:
	q = N // m
	r = N % m
	if q == r:
		ans += m
		i += 1
		m = div[i]
	else:
		m -= 1
print(ans)


# Optimized solution
N = int(eval(input()))
ans = 0

div = []  # Nの約数を全列挙してdivとする
for i in range(1, int(N ** 0.5) + 1):
	if N % i == 0:
		div.append(i)
		if i != N // i:
			div.append(N // i)

for j in range(len(div)):
	if div[j] == 1:  # m=0はskip
		pass
	else:
		m = div[j] - 1
		if N // m == N % m:
			ans += m

print(ans)
# Original solution
n = int(eval(input()))


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def is_favorite(n, m):
    if x == 0:
        return False
    else:
        return n // m == n % m


li = make_divisors(n)
li = [x - 1 for x in li]


ans = 0
for x in li:
    if is_favorite(n, x):
        ans += x

print(ans)

# Optimized solution
n = int(eval(input()))


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


# 約数から1引いたものが候補
arr = make_divisors(n)
arr = [x - 1 for x in arr if x >= 2]

#　商と剰余が不一致ならbreakできる
ans = 0
for x in arr[::-1]:
    if n // x != n % x:
        break
    ans += x

print(ans)
# Original solution
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N = int(stdin.readline().rstrip())

ans = 0
for k in range(1, int(math.sqrt(N+1))):
    if N % k == 0:
        # N = k(m+1) で表すことができる ...よってkはNの約数
        # m = N/k-1
        ans += ((N//k)-1)

print(ans)


# Optimized solution
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N = int(stdin.readline().rstrip())


ans = 0
for k in range(1, int(math.sqrt(N+1))):
    if N % k == 0:
        # N = k(m+1) で表すことができる ...よってkはNの約数で、N^0.5以下のもの
        # m = N/k-1
        ans += ((N//k)-1)

print(ans)
# Original solution
from math import floor

N = int(eval(input()))
ans = 0
sup = floor(pow(N,1/2))
for r in range(1,sup+1):
    if N % r == 0:
        m = N // r - 1
        if 0 <= r <= m-1:
            ans += m
print(ans)

# Optimized solution
from math import floor

def divisor(n):
    left = [1]
    right = [n]
    sup = floor(pow(n,1/2))
    for p in range(2,sup+1):
        if n % p == 0:
            left.append(p)
            right.append(n//p)
    res = left + right[::-1]
    return res
        
N = int(eval(input()))

div = divisor(N)
ans = 0

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

print(ans)
# Original solution
n, l = list(map(int, input().split()))

apple = []
diff = 1001001001
minus = False
for i in range(1, n+1):
    apple.append(l+i-1)
    if abs(l+i-1) < diff:
        diff = abs(l+i-1)
        if l+i-1 < 0:
            minus = True
        else:
            minus = False

if minus:
    print((sum(apple) + diff))
else:
    print((sum(apple) - diff))

# Optimized solution
n, l = list(map(int, input().split()))

apple = []
for i in range(1, n+1):
    apple.append(l+i-1)

eat = sorted(apple, key=lambda x: abs(x))
print((sum(apple)-eat[0]))
# Original solution
n,l = list(map(int,input().split()))
n_l = []
for i in range(n):
    n_l.append(i+l)
    
min_i = 100000
for i in n_l:
    if abs(i) < abs(min_i):
        min_i = i

print((sum(n_l) - min_i))


# Optimized solution
n,l = list(map(int,input().split()))

r = [l+i for i in range(n)]
min_r = 1000000000
for i in r:
    if min_r > abs(i):
        min_r = abs(i)
        ans = i
print((sum(r)-ans))
# Original solution
n, l = list(map(int, input().split()))
sa = 1000
sum = 0
for i in range(1,n+1):
    if sa != min(abs(l+i-1), sa):
        sa = min(abs(l+i-1), sa)
        app = l+i-1
    sum += l+i-1

print((sum-app))

# Optimized solution
n,l=list(map(int,input().split()))

ans=0
min_a=10**9
for i in range(n):
  ans+=l+i
  if abs(min_a)>abs(l+i):
    min_a=l+i
print((ans-min_a))
# Original solution
N, L = list(map(int, input().split()))
a = []
b = []

#ringo goto aji dasu
for i in range(N):
  a.append(L+ i+1 -1)

if max(a) < 0:
  print((sum(a)-max(a)))
elif max(a) >= 0 and min(a) <= 0:
  print((sum(a)))
else:
  print((sum(a)-min(a)))

# Optimized solution
N, L = list(map(int, input().split()))
a = []
for i in range(N):
  a.append(L+i+1-1)
  
if min(a) > 0:
  print((sum(a)-min(a)))
  
elif min(a)<=0 and max(a)>=0:
  print((sum(a)))
  
else:
  print((sum(a)-max(a)))
# Original solution
import heapq

n, l = list(map(int, input().split()))
taste = list(range(l, n + l))
ans = 0

if taste.count(0) == 1:
  ans = sum(taste)
elif max(taste) < 0:
  taste = list([x * (-1) for x in taste])
  heapq.heapify(taste)
  heapq.heappop(taste)
  ans = sum(taste) * (-1)
else:
  heapq.heapify(taste)
  heapq.heappop(taste)
  ans = sum(taste)
print(ans)

# Optimized solution
n, l = list(map(int, input().split()))
taste = list(range(l, n + l))
ans = 0

if taste.count(0) == 1:
  ans = sum(taste)
elif max(taste) < 0:
  taste.remove(max(taste))
  ans = sum(taste)
else:
  taste.remove(min(taste))
  ans = sum(taste)
print(ans)