#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
map<long long int, long long int> ind;
map<long long int, long long int> mem;
long long int solve(long long int n) {
  if (n == 1) return 0;
  if (mem[n] != -1) return mem[n];
  long long int t = ind[n];
  long long int res = 0;
  for (long long int i = 1; i <= t; i++)
    if (n % v[i] == 0) res = max(res, solve(n / v[i]) + n / v[i]);
  return mem[n] = res;
}
int main() {
  long long int n;
  cin >> n;
  for (long long int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      v.push_back(i);
      v.push_back(n / i);
    }
  }
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  for (long long int i = 0; i < v.size(); i++) {
    ind[v[i]] = i;
    mem[v[i]] = -1;
  }
  cout << n + solve(n) << endl;
  return 0;
}
