




def 		SCREAMING_SNAKE_CASE__   (       lowercase	)    ->  Union[str, Any]:


   if not grid or not grid[0]:
      raise TypeError("""The grid does not contain the appropriate information"""	)

   for cell_n in range(1		,len(grid[0]	)	):
      grid[0][cell_n] += grid[0][cell_n - 1]
   snake_case :							Optional[Any]           =			grid[0]

   for row_n in range(1		,len(__lowerCAmelCase	)	):
      snake_case :							Optional[int]           =			grid[row_n]
      snake_case :							str           =			fill_row(__lowerCAmelCase		,__lowerCAmelCase	)
      snake_case :							Optional[int]           =			grid[row_n]

   return grid[-1][-1]




def 		SCREAMING_SNAKE_CASE__   (       lowercase		,lowercase	)    ->  Optional[int]:
   current_row[0] += row_above[0]
   for cell_n in range(1		,len(__lowerCAmelCase	)	):
      current_row[cell_n] += min(current_row[cell_n - 1]		,row_above[cell_n]	)

   return current_row


if __name__ == "__main__":
       import doctest

       doctest.testmod()







from math import sqrt






def   lowerCamelCase__							(							__lowerCAmelCase    :    int							):




			"""simple docstring"""


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






def   lowerCamelCase__							(							__lowerCAmelCase    :    int = 10000							):




			"""simple docstring"""


			lowerCAmelCase_         =      sum(
			    i
			    for i in range(1       ,				__lowerCAmelCase							)
			    if sum_of_divisors(sum_of_divisors(__lowerCAmelCase							)							) == i and sum_of_divisors(__lowerCAmelCase							) != i							)
			return total


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



