X, Y = map(int, input().split()) cnt = [0] * (10000001) maxR = 0 while maxR * maxR <= Y: maxR += 1 maxR -= 1 for x in range(1, maxR + 1): for y in range(maxR + 1): if x * x + y * y <= Y: cnt[x * x + y * y] += 1 ans = 0 for i in range(X, Y + 1): if ans < cnt[i]: ans = cnt[i] print(ans * 4)