#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, hold;
  cin >> k;
  int x = sqrt(k);
  if (k - x * x == 0)
    cout << x * 4 << "\n";
  else {
    if ((x + 1) * x >= k)
      cout << (4 * x + 2) << "\n";
    else
      cout << (4 * (x + 1)) << "\n";
  }
  return 0;
}
