#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, sum = 0, g, flag = 0;
  cin >> n;
  g = n;
  for (int i = n - 1; i >= 1; i--) {
    if (n % i == 0) {
      sum = sum + i;
      n = i;
    }
    if (n == 1) {
      break;
    }
  }
  cout << sum + g << "\n";
  return 0;
}
