#include <bits/stdc++.h>
using namespace std;
int recur(int n);
int has(int n);
int main() {
  int n, ans;
  cin >> n;
  ans = recur(n);
  cout << ans + n << endl;
  return 0;
}
int recur(int n) {
  int a, b;
  b = has(n);
  if (b == 0) {
    return 1;
  }
  a = n / b;
  n /= b;
  if (n != 1) a += recur(n);
  return a;
}
int has(int n) {
  for (int i = 2; i < n - 1; ++i)
    if (n % i == 0) return i;
  return 0;
}
