#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int X,Y; cin >> X >> Y; int maxY = [Y]() { int r = 0; while(r * r <= Y) r++; return r - 1; }(); vector cnt(Y + 1, 0); for(int x = 1; x <= maxY; x++) { for(int y = 0; y <= maxY; y++) { int r2 = x * x + y * y; if(r2 <= Y) cnt[r2]++; } } int ma = 0; for(int i = X; i <= Y; i++) ma = max(ma, cnt[i]); cout << ma * 4 << endl; }