#208.py #tx,ty = input().split() #hx,hy = input().split() #tx,ty = int(tx),int(ty) #hx,hy = int(hx),int(hy) tx,ty = 2,1 hx,hy = 1,1 x,y = 0,0 x_,y_ = 0,0 lx,ly = -1,-1 c = 0 while(1): c += 1 lx = tx-x ly = ty-y if(lx+ly == 0): break if(lx == ly): x+=1 y+=1 if(lx > ly): x+=1 if(lx < ly): y+=1 if(hx == x)&(hy == y): if(x_ != x)&(y_ != y): if(tx <= ty): x-=1 if(tx > ty): y-=1 if(x_ == x): y+=1 if(y_ == y): x+=1 x_,y_ = x,y print(c)