ans = [0] * int(1e7 + 1) for i in range(1, 224): for j in range(0, 224): ans[i ** 2 + j ** 2] += 1 x, y = map(int, input().split()) print(max(ans[x:y + 1]) * 4)