module Main where import Control.Monad rotate :: Int -> Int -> Int rotate 0 y | y >= 0 = 0 rotate x y | y >= 0 = 1 | otherwise = 2 move :: Int -> Int -> Int move _ 0 = 0 move dt n | r == 0 = q | otherwise = q + 1 where (q, r) = (abs n) `divMod` dt main :: IO () main = do x <- readLn :: IO Int y <- readLn dt <- readLn print $ rotate x y + move dt x + move dt y