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