#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int main() {
  int n;
  cin >> n;
  long long res = 12045622226778;
  for (int i = 1; i <= n; ++i) {
    int x = n / i;
    if (n % i) ++x;
    res = min(res, 2ll * (x + i));
  }
  cout << res;
}
