#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, l, b, s, p = 0;
  scanf("%d", &n);
  l = (int)sqrt(n);
  if ((l * l) != n) {
    b = (int)(n / l);
    if (n % l == 0) {
      p = 2 * l + 2 * b;
    } else
      p = 2 * l + 2 * b + 2;
  } else
    p = 4 * l;
  printf("%d\n", p);
  return 0;
}
