#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int result = n;
  while ((n % 2 == 0 && n / 2 != 1) || (n % 3 == 0 && n / 3 != 1) ||
         (n % 5 == 0 && n / 5 != 1) || (n % 7 == 0 && n / 7 != 1)) {
    if (n % 2 == 0) {
      n /= 2;
    } else if (n % 3 == 0) {
      n /= 3;
    } else if (n % 5 == 0) {
      n /= 5;
    } else if (n % 7 == 0) {
      n /= 7;
    }
    result += n;
  }
  result += 1;
  cout << result << endl;
}
