#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; set factor; void all_factor(long long n){ factor.clear(); for (long long i = 1; i*i <= n; i++){ if (n % i == 0){ factor.insert(i); factor.insert(n / i); } } } int main(){ long long N, ans=0; cin >> N; if (N % 2 == 0) N /= 2; all_factor(N); for (auto x : factor) ans += x; cout << ans << endl; return 0; }