#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long long sum = n;
  while (n != 1) {
    int b = 2;
    while (n % b && b < sqrt((double)(n + 1))) {
      ++b;
    }
    if (b >= sqrt((double)(n + 1))) {
      n = 1;
    } else {
      n /= b;
    }
    sum += n;
  }
  cout << sum;
  return 0;
}
