#include <bits/stdc++.h>
using namespace std;
const int N = 110;
const int M = 1000000007;
int ans;
map<int, bool> m;
void dfs(int x, int s) {
  ans = max(ans, s + 1);
  if (m[x]) return;
  m[x] = 1;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) {
      dfs(i, s + i);
      dfs(x / i, s + x / i);
    }
}
int main() {
  int n;
  scanf("%d", &(n));
  ans = 0;
  dfs(n, n);
  printf("%d\n", (ans));
  return 0;
}
