#include <bits/stdc++.h>
using namespace std;
const long long maxc = 1e6 + 5;
long long prime[maxc];
void sieve() {
  fill(prime, prime + maxc, 1);
  prime[0] = 0;
  prime[1] = 0;
  for (long long i = 2; i <= maxc; i++) {
    if (prime[i]) {
      for (long long k = 2; k * i < maxc; k++) prime[i * k] = 0;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long a = 0;
  long long n;
  sieve();
  long long c = 0;
  cin >> n;
  c += n;
  while (prime[n] != 1) {
    for (long long i = 2; i * i <= n; i++) {
      long long p = i;
      if (n % p == 0) {
        long long q = n / p;
        a = max(p, q);
        break;
      }
    }
    c += a;
    n = a;
  }
  c++;
  cout << c << endl;
  return 0;
}
