#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  long long ret = n;
  while (1) {
    ;
    bool ok = 0;
    for (int i = 2; i * i <= n; ++i) {
      if (n % i == 0) {
        ok = 1;
        ret += max(i, n / i);
        n = n / i;
        break;
      }
    }
    if (!ok) {
      ret++;
      break;
    }
  }
  cout << ret << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
