#include <bits/stdc++.h>
using namespace std;
int getNumber(int n) {
  if (n % 2 == 0) return n / 2;
  for (int i = 3; i <= sqrt(n); i += 2) {
    if (n % i == 0) return n / i;
  }
  return 1;
}
int main() {
  int n;
  cin >> n;
  int t = n;
  bool flag = true;
  int temp;
  int sum = n;
  while (flag) {
    t = getNumber(t);
    sum += t;
    if (t == 1) flag = false;
  }
  cout << sum;
}
