





from math import sqrt





def  __magic_name__  (				lowercase				)				-> int:

							"""simple docstring"""



							lowercase_	:   Optional[int]  				=     0
							for i in range(1				,       int(sqrt(lowercase				) + 1				)				):
														if n % i == 0 and i != sqrt(lowercase				):
																					total += i + n // i
														elif i == sqrt(lowercase				):
																					total += i
							return total - n





def  __magic_name__  (				lowercase = 10000				)				-> int:

							"""simple docstring"""



							lowercase_	:   List[str]  				=     sum(
							    i
							    for i in range(1				,       lowercase				)
							    if sum_of_divisors(sum_of_divisors(lowercase				)				) == i and sum_of_divisors(lowercase				) != i				)
							return total


if __name__ == "__main__":
							print(solution(int(str(input()).strip())))






def  __magic_name__  (				lowercase = 100				)				-> int:

							"""simple docstring"""



							lowercase_	:   Dict  				=     (n * (n + 1) // 2) ** 2
							lowercase_	:   List[str]  				=     n * (n + 1) * (2 * n + 1) // 6
							return sum_cubes - sum_squares


if __name__ == "__main__":
							print(F'''{solution() = }''')