#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int t, n, m, k, a, b = 0, c, d, i, j, e, count = 0, min, sum, x, y;
  cin >> n;
  a = n;
  while (1) {
    if (n <= 1) break;
    if (n % 2 == 1) {
      for (i = n / 2; i >= 1; i--) {
        if (n % i == 0) {
          a += i;
          n = i;
          break;
        }
      }
    } else {
      a += n / 2;
      n = n / 2;
    }
  }
  cout << a;
  return 0;
}
