#include <bits/stdc++.h>
double eps = 1e-9;
int MAX = 1000000;
int MIN = -1000000;
int INF = 1000000000;
int i, j, k;
int x4[4] = {0, 1, 0, -1};
int y4[4] = {1, 0, -1, 0};
int x8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int y8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
using namespace std;
bool prima[50000];
vector<int> v;
void sieve() {
  int i, j;
  for (i = 2; i <= 40000; i++) {
    if (prima[i]) {
      v.push_back(i);
      for (j = i + i; j <= 40000; j += i) prima[j] = false;
    }
  }
}
bool cek_prima(int A) {
  int i;
  for (i = 0; i < v.size() && v[i] < A; i++)
    if (A % v[i] == 0) return false;
  return true;
}
int main() {
  memset((prima), (true), sizeof(prima));
  ;
  sieve();
  int n, jawaban;
  cin >> n;
  jawaban = n;
  while (n > 1) {
    if (cek_prima(n)) {
      jawaban += n / n;
      break;
    }
    for (i = (0); i < (v.size()); i++) {
      if (n % v[i] == 0) {
        jawaban += (n / v[i]);
        n /= v[i];
        break;
      }
    }
  }
  cout << jawaban << endl;
  {
    fflush(stdin);
    getchar();
  };
  return 0;
}
