#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, sum;
  int f;
  cin >> n;
  sum = n;
  while (1) {
    if (n % 2 == 0) {
      n = n / 2;
      sum += n;
      if (n == 1) break;
    } else {
      f = 0;
      for (i = n / 2; i >= 3; i--) {
        if (n % i == 0) {
          sum += i;
          n = i;
          f = 1;
          break;
        }
      }
      if (f == 0) {
        sum++;
        break;
      }
    }
  }
  cout << sum;
  return 0;
}
