#include <bits/stdc++.h>
using namespace std;
long long int mx = INT_MAX;
long long int mn = INT_MIN;
long long int mod = 1e9 + 7;
long long int maxs = 1e5 + 6;
long long int max2d = 1e3 + 3;
long long int v;
vector<long long int> *g;
bool isPrime(long long int n) {
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long int maxfact(long long int n) {
  if (n == 2) return 1;
  long long int i;
  for (i = n / 2 + 1; i >= 0; i--)
    if (n % i == 0) break;
  return i;
}
int main() {
  long long int n;
  cin >> n;
  long long int ans = n;
  if (isPrime(n))
    cout << ans + 1 << endl;
  else {
    while (1) {
      long long int tmp = maxfact(n);
      ans += tmp;
      if (tmp == 1) break;
      n = tmp;
    }
    cout << ans << endl;
  }
  return 0;
}
