#include <bits/stdc++.h>
using namespace std;
void printDivisors(long long int n, vector<long long int> &v) {
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        v.push_back(i);
      else {
        v.push_back(i);
        v.push_back(n / i);
      }
    }
  }
}
int main() {
  long long int n, sum = 0, j;
  cin >> n;
  vector<long long int> v;
  printDivisors(n, v);
  sort(v.begin(), v.end());
  for (long long int i = v.size() - 1; i >= 0; i--) {
    if (v[i] % v[i - 1] == 0 || i == 0) {
      sum = sum + v[i];
    } else {
      for (j = i - 1; j >= 0; j--) {
        if (v[i] % v[j] == 0) {
          sum = sum + v[i];
          i = j + 1;
          break;
        }
      }
    }
  }
  cout << sum << endl;
}
