#include <bits/stdc++.h>
using namespace std;
const int N = 100009;
const int M = 100004;
int k, p[M];
bool a[M];
void ini() {
  memset(a, true, sizeof(a));
  a[0] = a[1] = false;
  int i, j;
  k = 0;
  for (i = 2; i <= M; i++) {
    if (a[i]) {
      p[k++] = i;
      for (j = 2; j * i <= M; j++) {
        a[i * j] = false;
      }
    }
  }
}
void solve(long long n) {
  long long ans = n;
  int i, j;
  int t = n;
  for (i = 0; i < k && p[i] <= t; i++) {
    if ((t % p[i]) == 0) {
      while ((t % p[i]) == 0) {
        t /= p[i];
        ans += t;
      }
    }
    if (t == 1) break;
  }
  if (t > 1) ans++;
  cout << ans << endl;
}
int main() {
  ini();
  long long n;
  while (cin >> n) {
    solve(n);
  }
  return 0;
}
