#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int read() {
  char c;
  int num, f = 1;
  while (c = (char)getchar(), !isdigit(c))
    if (c == '-') f = -1;
  num = (int)(c - '0');
  while (c = (char)getchar(), isdigit(c)) num = num * 10 + (int)(c - '0');
  return num * f;
}
void prt(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) prt(x / 10);
  putchar(x % 10 + '0');
}
int n, ans;
void work() {
  n = read();
  ans = n;
  while (n != 1) {
    int c = 0;
    for (int i = 2; i <= sqrt(n); i++) {
      if (n % i == 0) {
        n = n / i;
        c = 1;
        break;
      }
    }
    if (c == 0) n = 1;
    ans += n;
  }
  printf("%d", ans);
  return;
}
signed main() {
  int T = 1;
  for (int Case = 1; Case <= T; Case++) {
    work();
  }
  return 0;
}
