#include <bits/stdc++.h>
using namespace std;
int n;
map<int, long long> ans;
inline long long go(int n) {
  if (ans.find(n) != ans.end()) return ans[n];
  long long cur = n + 1;
  for (int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      cur = max(cur, n + go(i));
      cur = max(cur, n + go(n / i));
    }
  }
  return ans[n] = cur;
}
int main() {
  cin >> n;
  ans[1] = 1;
  cout << go(n) << endl;
}
