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