#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
template <typename T>
void alert(const T& t) {
  cout << t << endl;
  exit(0);
}
bool cmd(const pair<int, int>& a, const pair<int, int>& b) {
  return a.second < b.second;
}
long long prime(long long n) {
  for (long long i = 2; i <= sqrt(n); i++)
    if (n % i == 0) return n / i;
  return 1;
}
int main() {
  {}
  int n;
  cin >> n;
  long long res = n;
  while (n > 1) {
    int k = prime(n);
    res += k;
    n = k;
  }
  cout << res << endl;
  return 0;
}
