#include <bits/stdc++.h>
using namespace std;
void init() {
  ios::sync_with_stdio(0);
  cin.tie(0);
}
int getRemaining(int a) {
  int n = a / 2;
  while (a % n != 0) n--;
  return n;
}
int main() {
  init();
  int n;
  cin >> n;
  int ans = n;
  do {
    n = getRemaining(n);
    ans += n;
  } while (n != 1);
  cout << ans << "\n";
}
