#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const double pi = acos(-1.0);
using namespace std;
int main() {
  int n;
  cin >> n;
  int sum = n;
  int num = 0;
  while (num != 1) {
    num = 1;
    for (int i = 1; i < n; i++) {
      if (n % i == 0) num = i;
    }
    sum = sum + num;
    n = num;
  }
  cout << sum;
}
