gx, gy = gets.split.map(&:to_i) px, py = gets.split.map(&:to_i) s = gx.abs + gy.abs s += 2 if [0,px,gx].uniq.size == 1 && (gy * py) > 0 && py.abs < gy.abs s += 2 if [0,py,gy].uniq.size == 1 && (gx * px) > 0 && px.abs < gx.abs puts s