#include using namespace std; int main() { int x, y; cin >> x >> y; vector v(y+1, 0); for (int i = 0; i * i <= y; i++) { for (int j = 1; j * j <= y; j++) { if (i*i+j*j > y) break; v[i*i+j*j]++; } } long long ans = 0; for (int i = x; i <= y; i++) { ans = max(ans, v[i]); } cout << ans * 4 << endl; return 0; }