#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int sum = n;
  int p = sqrt(n) + 1;
  bool flag = 1;
  for (int i = 2; i < p; i++) {
    if (n % i == 0) {
      while (n % i == 0 && n > 1) {
        n = n / i;
        if (n == 1) {
          flag = 0;
        }
        sum += n;
      }
    }
  }
  sum += flag;
  cout << sum;
  return 0;
}
