
'''simple docstring'''
from __future__ import annotations






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							_snake_case       =  [True] * limit
							_snake_case       =  False
							_snake_case       =  False
							_snake_case       =  True

							for i in range(3							, int(limit**0.5 + 1				)							, 2				):
														_snake_case       =  i * 2
														while index < limit:
																					_snake_case       =  False
																					_snake_case       =  index + i

							_snake_case       =  [2]

							for i in range(3							, _SCREAMING_SNAKE_CASE							, 2				):
														if is_prime[i]:
																					primes.append(_SCREAMING_SNAKE_CASE				)

							return primes






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE = 100_0000				):
							_snake_case       =  prime_sieve(_SCREAMING_SNAKE_CASE				)
							_snake_case       =  0
							_snake_case       =  0

							for i in range(len(_SCREAMING_SNAKE_CASE				)				):
														for j in range(i + length							, len(_SCREAMING_SNAKE_CASE				)				):
																					_snake_case       =  sum(primes[i:j]				)
																					if sol >= ceiling:
																												break

																					if sol in primes:
																												_snake_case       =  j - i
																												_snake_case       =  sol

							return largest


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

'''simple docstring'''
from math import sqrt






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							_snake_case       =  0
							for i in range(1							, int(sqrt(_SCREAMING_SNAKE_CASE				) + 1				)				):
														if n % i == 0 and i != sqrt(_SCREAMING_SNAKE_CASE				):
																					total += i + n // i
														elif i == sqrt(_SCREAMING_SNAKE_CASE				):
																					total += i
							return total - n






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE = 1_0000				):
							_snake_case       =  sum(
							    i
							    for i in range(1							, _SCREAMING_SNAKE_CASE				)
							    if sum_of_divisors(sum_of_divisors(_SCREAMING_SNAKE_CASE				)				) == i and sum_of_divisors(_SCREAMING_SNAKE_CASE				) != i				)
							return total


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