#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  int res = n;
  while (n > 1) {
    int x = n;
    int curr = 1;
    for (int i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        curr = x / i;
        break;
      }
    }
    n = curr;
    res += curr;
  }
  cout << res << "\n";
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
  }
  return 0;
}
