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