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

from sys import maxsize
from typing import Generic, TypeVar

__lowerCAmelCase												=	TypeVar('T')






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							return (position - 1) // 2






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							return (2 * position) + 1






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE				):
							return (2 * position) + 2


class       _lowerCAmelCase   (   Generic[T]				):







							'''simple docstring'''

							def __init__(self  )					->       None:
														_snake_case       =  []
														_snake_case       =  {}
														_snake_case       =  0

							def __len__(self  )					->       int:
														return self.elements

							def __repr__(self  )					->       str:
														return str(self.heap  )

							def 	lowercase							(self  )					->       bool:
														# Check if the priority queue is empty
														return self.elements == 0

							def 	lowercase							(self  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       None:
														# Add an element with given priority to the queue
														self.heap.append((elem, weight)  )
														_snake_case       =  self.elements
														self.elements += 1
														self._bubble_up(UpperCAmelCase  )

							def 	lowercase							(self  )					->       T:
														# Remove and return the element with lowest weight (highest priority)
														if self.elements > 1:
																					self._swap_nodes(0  ,  self.elements - 1  )
														_snake_case,							_snake_case       =  self.heap.pop()
														del self.position_map[elem]
														self.elements -= 1
														if self.elements > 0:
																					_snake_case,							_snake_case       =  self.heap[0]
																					self._bubble_down(UpperCAmelCase  )
														return elem

							def 	lowercase							(self  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       None:
														# Update the weight of the given key
														_snake_case       =  self.position_map[elem]
														_snake_case       =  (elem, weight)
														if position > 0:
																					_snake_case       =  get_parent_position(UpperCAmelCase  )
																					_snake_case,							_snake_case       =  self.heap[parent_position]
																					if parent_weight > weight:
																												self._bubble_up(UpperCAmelCase  )
																					else:
																												self._bubble_down(UpperCAmelCase  )
														else:
																					self._bubble_down(UpperCAmelCase  )

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
														# Place a node at the proper position (upward movement) [to be used internally
														# only]
														_snake_case       =  self.position_map[elem]
														if curr_pos == 0:
																					return None
														_snake_case       =  get_parent_position(UpperCAmelCase  )
														_snake_case,							_snake_case       =  self.heap[curr_pos]
														_snake_case,							_snake_case       =  self.heap[parent_position]
														if parent_weight > weight:
																					self._swap_nodes(UpperCAmelCase  ,  UpperCAmelCase  )
																					return self._bubble_up(UpperCAmelCase  )
														return None

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
														# Place a node at the proper position (downward movement) [to be used
														# internally only]
														_snake_case       =  self.position_map[elem]
														_snake_case,							_snake_case       =  self.heap[curr_pos]
														_snake_case       =  get_child_left_position(UpperCAmelCase  )
														_snake_case       =  get_child_right_position(UpperCAmelCase  )
														if child_left_position < self.elements and child_right_position < self.elements:
																					_snake_case,							_snake_case       =  self.heap[child_left_position]
																					_snake_case,							_snake_case       =  self.heap[child_right_position]
																					if child_right_weight < child_left_weight and child_right_weight < weight:
																												self._swap_nodes(UpperCAmelCase  ,  UpperCAmelCase  )
																												return self._bubble_down(UpperCAmelCase  )
														if child_left_position < self.elements:
																					_snake_case,							_snake_case       =  self.heap[child_left_position]
																					if child_left_weight < weight:
																												self._swap_nodes(UpperCAmelCase  ,  UpperCAmelCase  )
																												return self._bubble_down(UpperCAmelCase  )
														else:
																					return None
														if child_right_position < self.elements:
																					_snake_case,							_snake_case       =  self.heap[child_right_position]
																					if child_right_weight < weight:
																												self._swap_nodes(UpperCAmelCase  ,  UpperCAmelCase  )
																												return self._bubble_down(UpperCAmelCase  )
														return None





							def 	lowercase							(self  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       None:
														# Swap the nodes at the given positions
														_snake_case       =  self.heap[nodea_pos][0]
														_snake_case       =  self.heap[nodea_pos][0]
														_snake_case,							_snake_case       =  (
														    self.heap[nodea_pos],
														    self.heap[nodea_pos],
														)
														_snake_case       =  nodea_pos
														_snake_case       =  nodea_pos


class       _lowerCAmelCase   (   Generic[T]				):







							'''simple docstring'''

							def __init__(self  )					->       None:
														_snake_case       =  {}
														_snake_case       =  0

							def __repr__(self  )					->       str:
														return str(self.connections  )

							def __len__(self  )					->       int:
														return self.nodes

							def 	lowercase							(self  ,  UpperCAmelCase  )					->       None:
														# Add a node in the graph if it is not in the graph
														if node not in self.connections:
																					_snake_case       =  {}
																					self.nodes += 1





							def 	lowercase							(self  ,  UpperCAmelCase  ,  UpperCAmelCase  ,  UpperCAmelCase  )					->       None:
														# Add an edge between 2 nodes in the graph
														self.add_node(UpperCAmelCase  )
														self.add_node(UpperCAmelCase  )
														_snake_case       =  weight
														_snake_case       =  weight






def  __SCREAMING_SNAKE_CASE				(  _SCREAMING_SNAKE_CASE							, ):
							_snake_case       =  {node: maxsize for node in graph.connections}
							_snake_case       =  {node: None for node in graph.connections}

							_snake_case       =  MinPriorityQueue()
							for node, weight in dist.items():
														priority_queue.push(_SCREAMING_SNAKE_CASE							, _SCREAMING_SNAKE_CASE				)

							if priority_queue.is_empty():
														return dist, parent

							# initialization
							_snake_case       =  priority_queue.extract_min()
							_snake_case       =  0
							for neighbour in graph.connections[node]:
														if dist[neighbour] > dist[node] + graph.connections[node][neighbour]:
																					_snake_case       =  dist[node] + graph.connections[node][neighbour]
																					priority_queue.update_key(_SCREAMING_SNAKE_CASE							, dist[neighbour]				)
																					_snake_case       =  node

    # running prim's algorithm
							while not priority_queue.is_empty():
														_snake_case       =  priority_queue.extract_min()
														for neighbour in graph.connections[node]:
																					if dist[neighbour] > dist[node] + graph.connections[node][neighbour]:
																												_snake_case       =  dist[node] + graph.connections[node][neighbour]
																												priority_queue.update_key(_SCREAMING_SNAKE_CASE							, dist[neighbour]				)
																												_snake_case       =  node
							return dist, parent

'''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())))