#include <bits/stdc++.h>
using namespace std;
int i, j, m, n, p, k;
int main() {
  scanf("%d", &n);
  long long ans = 0;
  while (n > 1) {
    ans += n;
    for (i = 2; i * i <= n; ++i)
      if (n % i == 0) break;
    if (n % i == 0)
      n = n / i;
    else
      n = 1;
  }
  ans += n;
  printf("%I64d\n", ans);
}
