X,Y = map(int,input().split()) ab = [] for i in range(int((10**7)**(1/2))+1): ab.append(i**2) v = [0]*(10**7+1) for i in range(1,len(ab)-1): for j in range(i+1,len(ab)): if ab[i]+ab[j] > 10000000: continue else: v[ab[i]+ab[j]] += 2 for i in range(1,len(ab)): if ab[i]+ab[i] > 10000000: continue v[ab[i]+ab[i]] += 1 v[ab[i]] += 1 ans = 0 for i in range(X,Y+1): if ans < v[i]: ans = v[i] print(ans*4)