#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long ans = n;
  while (n != 1) {
    bool done = false;
    int s = sqrt(double(n));
    for (int i = 2; i <= s; i++)
      if (n % i == 0) {
        n = n / i;
        done = true;
        break;
      }
    if (!done) n = 1;
    ans += n;
  }
  cout << ans << endl;
}
