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