X,Y =map(int,input().split()) lis =[0]*(Y+1) for i in range(1,int(Y**0.5)+1): for j in range(int((X-i**2)**0.5),int((Y-i**2)**0.5)+1): lis[i**2+j**2] += 1 print(max(lis[X:Y+1])*4)