main :: IO () main = interact $ show . solve . map read . words myCeiling :: Int -> Int -> Int myCeiling m n = ceiling $ (fromIntegral m) / (fromIntegral n) solve :: [Int] -> Int solve [x, y, l] | x /= 0 && y >= 0 = (myCeiling y l) + 1 + (myCeiling (abs x) l) | y < 0 = 1 + (myCeiling (abs x) l) + 1 + (myCeiling (abs y) l) | otherwise = 0