#include <bits/stdc++.h>
using namespace std;
int prime(int);
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  vector<int> factor;
  int index = 2;
  while (n > 1) {
    if (prime(n) == 1) {
      factor.push_back(n);
      break;
    }
    if (n % index == 0) {
      factor.push_back(index);
      n /= index;
    } else
      do index++;
      while (prime(index) == 0);
  }
  int count = 1;
  for (int i = 0; i < factor.size(); i++) {
    count *= factor[i];
    count++;
  }
  cout << count;
}
int prime(int n) {
  double q = sqrt(n);
  int flag = 0;
  for (int i = 2; i <= q; i++) {
    if (n % i == 0) {
      flag = 1;
      break;
    }
  }
  if (flag == 0)
    return 1;
  else
    return 0;
}
