#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long y = n, py = n;
  long long t = n;
  long long i = 0;
  long long N = n * n;
  if (n == 0) {
    cout << 1 << endl;
    return 0;
  }
  for (i = 1; i <= n; i++) {
    y = (long long)sqrt((double)(N - (i * i)));
    if (y < py) t += py - y - 1;
    py = y;
  }
  long long ans = 4 * t;
  cout << ans << endl;
}
