#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
const int N = 1e5 + 10;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 1; i * i <= n; i++) {
    if (n % i) continue;
    v.push_back(i);
    v.push_back(n / i);
  }
  sort(v.begin(), v.end());
  map<int, int> ans;
  for (auto &x : v) {
    int tmp = 0;
    for (auto &y : v) {
      if (y == 1) continue;
      if (x % y) continue;
      tmp = max(tmp, ans[x / y]);
    }
    ans[x] = x + tmp;
  }
  cout << ans[n] << endl;
  return 0;
}
