#include <bits/stdc++.h>
using namespace std;
int main() {
  double n;
  cin >> n;
  double sum = 0;
  if (sqrt(n) == round(sqrt(n))) {
    sum = 4 * sqrt(n);
  } else {
    sum = 2 * floor(2 * sqrt(n)) + 2;
  }
  cout << sum << endl;
}
