#include <bits/stdc++.h>
using namespace std;
long long k, cons = 0;
long long arr[200000];
int prime(long long x) {
  int truee = 0, t;
  for (k = 2; k * k <= x; k++) {
    if (x % k == 0) {
      truee = 1;
      break;
    }
  }
  if (truee == 1) {
    return 0;
  } else {
    return 1;
  }
}
int fib(int n) {
  if (n == 1 || n == 0) {
    return 1;
  } else {
    return (fib(n - 1) + fib(n - 2));
  }
}
long long gcd(long long a, long long b) {
  if (a < b)
    return gcd(b, a);
  else if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int n;
bool sorted(vector<int> &a) {
  for (int i = 0; i < a.size() - 1; i++) {
    if (a[i + 1] < a[i]) return 0;
  }
  return 1;
}
int main() {
  long long t, maxi, j, i;
  t = 1;
  while (t--) {
    long long T, a, b, c, index = -1, k, intmax, x, y, temp, count = 0,
                          countsmall = 0;
    long long sum = 0, m = 0, total = 0, breaks = 0;
    maxi = INT_MIN;
    map<int, int> map1;
    cin >> n;
    total = 0;
    if (prime(n)) {
      cout << n + 1 << endl;
    } else {
      while (n != 1) {
        k = 2;
        while (n % k != 0) {
          k++;
        }
        if (n % k == 0) {
          total = total + n;
          n = n / k;
        }
      }
      total = total + 1;
      cout << total;
    }
  }
}
