#include <bits/stdc++.h>
using namespace std;
unsigned long start_n, maxsum = 0, sum;
unsigned long getsum(unsigned long n) {
  if (n < 2) return 0;
  unsigned long b = 1, n2 = n / 2;
  for (unsigned long a = 2; a <= n2; a++) {
    if (n % a == 0) {
      b = n / a;
      break;
    }
  }
  return b + getsum(b);
}
int main() {
  cin >> start_n;
  cout << start_n + getsum(start_n) << endl;
  return 0;
}
