#include <bits/stdc++.h>
using namespace std;
int dp[64];
int calc(int n) {
  if (n == 1) return 1;
  if (dp[n] == -1) {
    dp[n] = -(1 << 29);
    for (int r = 2; r <= n; ++r)
      if (n % r == 0) dp[n] = max(dp[n], n + calc(n / r));
  }
  return dp[n];
}
int main() {
  int n;
  cin >> n;
  memset(dp, -1, sizeof(dp));
  cout << calc(n) << endl;
  return 0;
}
