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