#include <bits/stdc++.h>
using namespace std;
int m, n, t, p, q, r, w;
int a[100000], b[100000];
int main() {
  long long d, sum = 0, f = 0;
  scanf("%I64d", &d);
  sum = d;
  while (d >= 1) {
    f = 0;
    for (int i = 2; i * i <= d; i++)
      if (d % i == 0) {
        sum += max((long long)i, d / i);
        d = max((long long)i, d / i);
        f = 1;
        break;
      }
    if (!f) {
      sum += 1;
      break;
    }
  }
  printf("%I64d\n", sum);
  return 0;
}
