#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  if (n == 1) {
    cout << 4;
    return 0;
  }
  if (n == 0) {
    cout << 1;
    return 0;
  }
  n = n * n;
  auto low = 1ll, high = low;
  while (2 * high * high <= n) {
    low = high;
    high *= 2;
  }
  while (low < high) {
    auto mid = (high + low) / 2 + 1;
    if (2 * mid * mid <= n) {
      low = mid;
    } else {
      high = mid - 1;
    }
  }
  if ((low + 1) * (low + 1) <= n - low * low) {
    cout << 8 * low + 4;
  } else {
    cout << 8 * low;
  }
  return 0;
}
