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