#include <bits/stdc++.h>
using namespace std;
int n, sums = 0;
void dequy(int a, int sum) {
  if (a == 1) {
    sums = max(sums, sum);
  } else
    for (int b = 1; b < a; ++b)
      if (a % b == 0 && ((a - b) >= 1)) dequy(b, sum + b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  dequy(n, n);
  cout << sums << endl;
  return 0;
}
