#include <bits/stdc++.h>
int cal(int n) {
  int i;
  for (i = 2; i * i <= n; ++i) {
    if ((n % i) == 0) return n / i;
  }
  return 1;
}
int main(int argc, char *argv[]) {
  int n, s = 0;
  scanf("%d", &n);
  s = n;
  int t = n;
  while (t > 1) {
    t = cal(t);
    s += t;
  }
  printf("%d\n", s);
  return 0;
}
