def sum_of_divisors(n): if n == 0: return 0 factors = {} # Factor out 2s while n % 2 == 0: factors[2] = factors.get(2, 0) + 1 n = n // 2 # Factor for odd numbers starting from 3 i = 3 max_factor = int(n**0.5) + 1 while i <= max_factor and n > 1: while n % i == 0: factors[i] = factors.get(i, 0) + 1 n = n // i max_factor = int(n**0.5) + 1 i += 2 if n > 1: factors[n] = 1 # Calculate the sum of divisors total = 1 for p, exp in factors.items(): total *= (p**(exp + 1) - 1) // (p - 1) return total N = int(input()) if N % 2 == 0: d = N // 2 else: d = N print(sum_of_divisors(d))