#include <bits/stdc++.h>
using namespace std;
long long n, m, ans;
long long pr(long long v) {
  for (long long i = 2; i * i <= v; i++) {
    if (v % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  if (pr(n)) {
    cout << n + 1 << endl;
    return 0;
  }
  while (n > 1) {
    if (n % 2 == 0) {
      ans += n;
      n /= 2;
    } else if (n % 3 == 0) {
      ans += n;
      n /= 3;
    } else if (n % 5 == 0) {
      ans += n;
      n /= 5;
    } else if (n % 7 == 0) {
      ans += n;
      n /= 7;
    } else if (pr(n)) {
      cout << ans + n + 1 << endl;
      return 0;
    }
  }
  cout << ans + 1 << endl;
}
