x,y=map(int,input().split()) r=(x**2+y**2)**(1/2) rs=r//1 if rs==r: print((rs+1)*2) else: print(rs*2)