Factor Fusion

View as PDF

Submit solution

Points: 100
Time limit: 0.5s
Memory limit: 977M

Author:
Problem type

Given an integer n, return the sum of all of its unique factors.

Input

Your first line will contain an integer n.

Output

The sum of all unique factors of n.

Constraints

For all test cases:

  • 1 \le n \le 10^7

Example 1

Input
10
Output
18
Explanation

The factors of 10 are 1, 2, 5, 10. The sum of these factors is 18.

Example 2

Input
4
Output
7
Explanation

The factors of 4 are 1, 2, 4. The sum of these factors is 7.

Python Template

n = int(input())

Comments

There are no comments at the moment.