#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long sum = n;
  while (n != 1) {
    int i = 2;
    for (; i <= sqrt(n); i++) {
      if (n % i == 0) {
        break;
      }
    }
    if (n % i == 0)
      n = n / i;
    else
      n = 1;
    sum += n;
  }
  cout << sum << endl;
}
