#include using namespace std; using ll = long long; using Graph = vector>; using ull = unsigned long long; int main() { long long N; cin >> N; long long ans = 1ll << 60ll; vector a; if(N == 1) { cout << 0 << endl; return 0; } while(true) { bool fire = true; for(int i = 2; i <= sqrt(N); i++) { if(N % i == 0){ N /= i; fire =false; a.push_back(i); break; } } if(fire) break; } a.push_back(N); ans = 0; for(int i = 0; i < a.size(); i++) { ans += a[i]; } cout << ans << endl; }