#include <bits/stdc++.h>
using namespace std;
int del(int n) {
  double q = n;
  if (n % 2 == 0) return 2;
  for (int i = 3; i < sqrt(q) + 1; i = i + 2) {
    if (n % i == 0) return i;
  }
  return 1;
}
int main() {
  int n;
  cin >> n;
  long int s;
  s = n;
  int de = n;
  while (n != 1) {
    de = del(n);
    n = n / de;
    if (de == 1) {
      s++;
      cout << s;
      return 0;
    };
    s += n;
  }
  cout << s;
  return 0;
}
