#include <bits/stdc++.h>
using namespace std;
long long int printDivisors(long long n) {
  vector<long long> v;
  long long e = 0, o = 0;
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i) {
        v.push_back(i);
      } else {
        v.push_back(i);
        v.push_back(n / i);
      }
    }
  }
  sort(v.rbegin(), v.rend());
  return v[1];
}
int main() {
  long long int n, x, y, t;
  cin >> n;
  x = n;
  while (1) {
    n = printDivisors(n);
    x = x + n;
    if (n == 1) break;
  }
  cout << x << endl;
}
