X, Y = map(int, input().split()) square = [i ** 2 for i in range(4000)] count = [0 for i in range(10**7 + 1)] for i in range(4000): for j in range(1, 4000): k = square[i] + square[j] if k <= 10**7: count[k] += 1 print(max(count[X: Y + 1]) * 4)