x,y = map(int,input().split()) ans = 0 dp = [0]*(y+1) Y = int(y**0.5+50) for i in range(1,Y+1): tmp = i**2 for j in range(1,Y+1): idx = tmp+j**2 if idx > y: break dp[idx] += 1 #print(dp) print(max(dp[x:y+1])*4)