#include <bits/stdc++.h>
using namespace std;
int main(void) {
  float a;
  cin >> a;
  float root = pow(a, 0.5);
  int w = ceil(root);
  float z = a / w;
  int h = ceil(z);
  cout << (2 * (h + w));
  return 0;
}
