#include #include #include #include #include #include #include #include #define REP(i,k,n) for(int i=k;i P; ll gcd(ll a, ll b) { if(b == 0) return a; return gcd(b, a%b); } vector divisor(ll n) { vector res; for(ll i = 2; i*i <= n; i++) { if(n % i == 0) { res.push_back(i); if(i != n/i) res.push_back(n/i); } } return res; } int main() { ll n; cin >> n; ll a = n; if(n%2 == 0) { n /= 2; } vector ret = divisor(a); ret.push_back(1); if(a != 1) ret.push_back(a); ll ans = 0; rep(i,ret.size()) { ans += ret[i]; } cout << ans << endl; return 0; }