





"""simple docstring"""



from math import sqrt







def 		__lowercase					(       snake_case_  :  int						)       ->int:



    '''simple docstring'''







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







def 		__lowercase					(       snake_case_  :  int = 10000						)       ->int:



    '''simple docstring'''







    __A   :						str									=					sum(
        i
        for i in range(1    ,snake_case_						)
        if sum_of_divisors(sum_of_divisors(snake_case_						)						) == i and sum_of_divisors(snake_case_						) != i						)
    return total


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











"""simple docstring"""



from typing import TYPE_CHECKING

from ....utils import _LazyModule


a_			=      {"""tokenization_tapex""": ["""TapexTokenizer"""]}


if TYPE_CHECKING:
       from .tokenization_tapex import TapexTokenizer


else:
       import sys

       a_			=      _LazyModule(__name__, globals()["""__file__"""], _import_structure)




