#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, r;
  cin >> n;
  m = sqrt(n);
  r = 4ll * m;
  if (m * m >= n) {
    r += 0;
  } else {
    if (m * (m + 1) >= n) {
      r += 2;
    } else {
      r += 4;
    }
  }
  cout << r << endl;
}
