#include <bits/stdc++.h>
using namespace std;
int squareroot(int x) {
  for (int k = 0; k < x; k++) {
    if (k * k <= x && (k + 1) * (k + 1) > x) {
      return k;
      break;
    }
  }
}
int main() {
  int x;
  cin >> x;
  int y = squareroot(x);
  if (y * y == x)
    cout << 4 * y << endl;
  else if (y * (y + 1) < x)
    cout << (y + 1) * 4;
  else
    cout << 2 * y + 2 * (y + 1);
}
