




from math import sqrt




def 						SCREAMING_SNAKE_CASE__ (   lowercase					)  ->       int:
   snake_case				:    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 						SCREAMING_SNAKE_CASE__ (   lowercase = 10000					)  ->       int:
   snake_case				:    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())))







def 						SCREAMING_SNAKE_CASE__ (   )  ->       Dict:
   snake_case				:    Optional[int]           =	[]
   snake_case				:    Tuple           =	1

   while len(lowercase					) < 1E6:
      constant.append(str(lowercase					)					)
      i += 1

   snake_case				:    int           =	"""""".join(lowercase					)

   return (
       int(constant[0]					)
       * int(constant[9]					)
       * int(constant[99]					)
       * int(constant[999]					)
       * int(constant[9999]					)
       * int(constant[99999]					)
       * int(constant[999999]					)
   )


if __name__ == "__main__":
       print(solution())





