#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int ans = 1;
  while (n > 1) {
    ans += n;
    int old = n;
    for (int i = (2); i <= ((int)sqrt(n) + 2); ++i) {
      if (n % i == 0) {
        n = n / i;
        break;
      }
    }
    if (old == n) break;
  }
  printf("%d\n", ans);
  return 0;
}
