#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define llong long long int main() { int x, y; cin >> x >> y; vector lens; for(int i=0; i y) break; lens.push_back(i*i); } map cands; for(int i: lens) { for(int j: lens) { if(j==0) continue; int val = i+j; if(val < x || y < val) continue; if(cands.find(val) == cands.end()) cands[val] = 1; else cands[val] += 1; } } int result = 0; for(pair p: cands) { result = max(result, p.second); } cout << 4 * result << "\n"; }