#include using namespace std; int freq[10000001]; int main(){ cin.tie(0); ios::sync_with_stdio(false); int X, Y; cin >> X >> Y; for (int x = 1; x*x <= Y; ++x){ for (int y = 0; x*x + y*y <= Y; ++y){ ++freq[x*x + y*y]; } } cout << *max_element(freq+X, freq+Y+1) * 4 << endl; return 0; }