main :: IO ()
main = getLine >>= print . solve . map read . words

solve :: [Integer] -> Integer
solve [x, y] | 0 <= x && x <= y = y - x
             | -x <= y = 1 + x + y
             | x <= y = y - x
             | 0 <= x = 1 - x - y
             | otherwise = 2 + x - y
