#include #include #include #include #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) typedef long long ll; using namespace std; vector sieve_of_eratosthenes(int n) { // enumerate primes in [2,n] with O(n log log n) vector is_prime(n+1, true); is_prime[0] = is_prime[1] = false; for (int i = 2; i*i <= n; ++i) if (is_prime[i]) for (int k = i+i; k <= n; k += i) is_prime[k] = false; vector primes; for (int i = 2; i <= n; ++i) if (is_prime[i]) primes.push_back(i); return primes; } map factors(ll n, vector const & primes) { map result; for (int p : primes) { if (n < p *(ll) p) break; while (n % p == 0) { result[p] += 1; n /= p; } } if (n != 1) result[n] += 1; return result; } ll f(ll x) { vector primes = sieve_of_eratosthenes(sqrt(x) + 3); ll result = 1; for (auto it : factors(x, primes)) { ll p; int cnt; tie(p, cnt) = it; ll acc = 1; ll e = 1; repeat (i, cnt) { e *= p; acc += e; } result *= acc; } return result; } int main() { ll n; cin >> n; ll x = n % 2 == 0 ? n/2 : n; cout << f(x) << endl; return 0; }