#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename U, typename V>
string to_string(pair<U, V>);
string to_string(string& e) { return "\"" + e + "\""; }
string to_string(char e) { return "\'" + string(1, e) + "\'"; }
string to_string(bool e) { return e ? "true" : "false"; }
template <typename T>
string to_string(T e) {
  string s = "[ ";
  for (auto& x : e) s += to_string(x) + " ";
  return s + "]";
}
template <typename U, typename V>
string to_string(pair<U, V> e) {
  return "(" + to_string(e.first) + ", " + to_string(e.second) + ")";
}
void dbg_str() { ; }
template <typename U, typename... V>
void dbg_str(U u, V... v) {
  ;
  dbg_str(v...);
}
using ld = long double;
ll n;
ll solve() {
  if (n == 0) return 1;
  if (n == 1) return 4;
  ll ans = 4;
  ll x = (ll)floor((ld)n / sqrt((ld)2));
  ll y = (ll)floor(sqrt((ld)(n * n - x * x)));
  ans += x * 8;
  if (x == y) ans -= 4;
  return ans;
}
int main() {
  scanf("%lld", &n);
  printf("%lld\n", solve());
}
