#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  int i, j, k;
  long long sum;
  while (scanf("%d", &n) != EOF) {
    sum = 0;
    m = n;
    while (n > 1) {
      k = int(sqrt(1.0 * n) + 0.5);
      bool tmp = 0;
      for (i = 2; i <= k; i++) {
        if (n % i == 0) {
          sum += n / i;
          n /= i;
          tmp = 1;
          break;
        }
      }
      if (!tmp) {
        sum++;
        break;
      }
    }
    printf("%I64d\n", sum + m);
  }
  return 0;
}
