x,y=map(int,input().split()) a=[0 for i in range(y+1)] for xx in range(1,int(y**0.5)+1): for yy in range(int(y**0.5)+1): d=xx**2+yy**2 if (d>=x) and (d<=y): a[d]+=1 print(max(a)*4)