~/algor $ cat problems/sonlar-ekublar-yigindisi
Sum of GCDs
Hard
1000 ms
128 MB
95%
You are given a positive integer $n$. Find the sum $\gcd(1, n) + \gcd(2, n) + \ldots + \gcd(n, n)$, where $\gcd(x, y)$ is the greatest common divisor (GCD) of $x$ and $y$. For example, for $n = 6$ it is $1 + 2 + 3 + 2 + 1 + 6 = 15$.
Input
One positive integer $n$.
Output
One integer — the sum.
Note
$1 \le n \le 10^{12}$
Examples
Input #1
6
Output #1
15
Input #2
1
Output #2
1