Sum of Proper DivisorsEasy

Sum of Proper Divisors

EasyPractice library · +10 XPmathnumber theory

Given a positive integer N, compute the sum of all its positive divisors, excluding N itself. These divisors are often called the proper divisors.

Input

A single line containing a positive integer N.

Output

A single integer representing the sum of the proper divisors of N.

Constraints

1 <= N <= 1000

Time limit 1 s (native code; slower languages get more)Memory 256 MB13 hidden tests

Example 1

Input
12
Output
16

The proper divisors of 12 are 1, 2, 3, 4, 6. Their sum is 1 + 2 + 3 + 4 + 6 = 16.

Example 2

Input
28
Output
28

The proper divisors of 28 are 1, 2, 4, 7, 14. Their sum is 1 + 2 + 4 + 7 + 14 = 28. (28 is a perfect number)

Hints