#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, b, s;
  int c = sqrt(n);
  if (c * c != n) {
    a = sqrt(n) + 1;
    b = sqrt(n);
    if (a * b < n) {
      a++;
    }
  } else {
    a = b = sqrt(n);
  }
  s = 2 * (a + b);
  cout << s;
}
