#include <bits/stdc++.h>
using namespace std;
long long my(long long a) {
  for (long long i = 2; i * i <= a; i++) {
    if (a % i == 0) return a / i;
  }
  return 1;
}
int main() {
  int a;
  long long sum = 0;
  cin >> a;
  while (a != 1) {
    sum += a;
    a = my(a);
  }
  cout << sum + 1 << endl;
  return 0;
}
