#include <bits/stdc++.h>
using namespace std;
int mark(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return i;
  }
  return 0;
}
int main() {
  int n;
  cin >> n;
  int res = n;
  while (n != 1) {
    if (n % 2 == 0) {
      n = n / 2;
      res += n;
    } else {
      int x = mark(n);
      if (x == 0) {
        res += 1;
        n = 1;
      } else {
        n /= x;
        res += n;
      }
    }
  }
  cout << res << endl;
}
