





"""simple docstring"""




from math import sqrt





def 	a_    (							_lowercase       ):
						_UpperCamelCase      : List[Any]         =   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 	a_    (							_lowercase = 1_0000       ):
						_UpperCamelCase      : List[Any]         =   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())))










"""simple docstring"""




def 	a_    (							_lowercase = 100       ):
						_UpperCamelCase      : List[Any]         =   0
						_UpperCamelCase      : Optional[Any]         =   0
						for i in range(1	,						n + 1       ):
												sum_of_squares += i**2
												sum_of_ints += i
						return sum_of_ints**2 - sum_of_squares


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



