#P1734. 最大约数和

最大约数和

Description

Select several distinct positive integers whose total sum does not exceed SS, so that the sum of the proper divisors (excluding the number itself) of all selected numbers is maximized.

Input Format

Input a positive integer SS.

Output Format

Output the maximum possible sum of proper divisors.

11
9

Hint

【Sample Explanation】

Choose the numbers 44 and 66 to obtain the maximum value (1+2)+(1+2+3)=9(1+2)+(1+2+3)=9.

【Constraints】

For 100%100\% of the testdata, 1S10001 \le S \le 1000.

Translated by ChatGPT 5