#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; static const int MAXN = 10000005; int cnt[MAXN]; int main(){ int X, Y; cin >> X >> Y; vector v; ll p = 0; while(p*p < MAXN){ v.push_back(p*p); p++; } rep(i,v.size()){ rep(j,v.size()){ int val = v[i] + v[j]; if(val < MAXN){ if(v[i] == 0 || v[j] == 0) cnt[val] += 2; else cnt[val] += 4; } } } int ret = 0; REP(i,X,Y+1){ ret = max(ret, cnt[i]); } cout << ret << endl; return 0; }