getSmall x y = if x < y then x else y solve [x,y,d] | d == 0 = 1 | m < d = 0 | x < d && y < d = m - d + 1 | x < d || y < d = (getSmall x y) + 1 | otherwise = d + 1 where m = (abs x) + (abs y) -- マンハッタン距離 main = do xyd <- map (abs . read :: String -> Int) . words <$> getLine print $ solve xyd