1 #include <cstdio>
2 #include <iostream>
3 #include <string>
4 #include <cstring>
5 #include <cmath>
6 #define LL long long
7 using namespace std;
8 LL n, ans, k;
9
10 LL phi(LL x)
11 {
12 LL k = x;
13 for (int i = 2; x > 1; i++)
14 if (x % i == 0)
15 {
16 k -= k / i;
17 while (x % i == 0) x /= i;
18 }
19 return k;
20 }
21
22 int main()
23 {
24 freopen("beats.in", "r", stdin);
25 freopen("beats.out", "w", stdout);
26 cin >> n;
27 int p = sqrt(n);
28 for (int i = 1; i <= p; i++)
29 if (n % i == 0)
30 {
31 k = i;
32 ans += k * phi(n / k);
33 if (k != n / k) k = n / i, ans += k * phi(n / k);
34 }
35 cout << ans + 1;
36 return 0;
37 }