x, y = map(int, input().split()) num = [0]*(10**7+1) for a in range(3164): for b in range(1, 3164): if a**2 + b**2 > 10**7: break num[a**2+b**2] += 1 print(max(num[x:y+1])*4)