#include <bits/stdc++.h>
using namespace std;
long long n, N, kor, sum;
int main() {
  scanf("%I64d", &n);
  sum = n;
  N = n;
  kor = sqrt(n);
  for (int i = 2; i <= n; ++i) {
    while (!(n % i)) {
      n /= i;
      sum += n;
      if (n == 1) {
        printf("%I64d\n", sum);
        return 0;
      }
    }
    if (sum == N && i == kor) {
      sum++;
      printf("%I64d\n", sum);
      return 0;
    }
  }
  printf("%I64d\n", sum);
  return 0;
}
