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