#include using namespace std; using i64 = int64_t; using vi = vector; using vvi = vector; int main() { i64 n; i64 ret = 0; cin >> n; __int128_t s = __int128_t(n) * (n + 1) / 2; i64 g = __gcd(s, __int128_t(n)); for (i64 i = 1; i * i <= g; i++) { if (n % i == 0) { ret += i; if (i != n / i) { ret += n / i; } } } cout << ret << endl; }