#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v;
  while (n % 2 == 0) {
    v.push_back(2);
    n = n / 2;
  }
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      v.push_back(i);
      n = n / i;
    }
  }
  if (n > 2) v.push_back(n);
  int ans1 = 1;
  int ans = 0;
  for (auto it = v.rbegin(); it != v.rend(); it++) {
    ans1 = ans1 * (*it);
    ans = ans + ans1;
  }
  cout << ans + 1;
}
