import math a,b = map(int,input().split()) cnt = [0] * 10000010 r = int(math.sqrt(b)) for i in range(1,r+1): for j in range(r+1): if i*i + j*j <= b: cnt[i*i + j*j]+=1 ans = 0 for i in range(a,b+1): ans = max(ans, cnt[i]) print (4*ans)