#include <bits/stdc++.h>
using namespace std;
const int Maxn = 50 + 10;
int dp[Maxn];
int F(int n) {
  if (dp[n] > 0) return dp[n];
  if (n == 1) return 1;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) dp[n] = max(F(i) + n, max(dp[n], F(n / i) + n));
  }
  dp[n] = max(dp[n], n + 1);
  return dp[n];
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  cout << F(n);
}
