main = getContents >>= print . solve . map read . lines solve :: [Int] -> Int solve [x, y, l] = a + b + c + d + e where a = div (abs x) l + if mod (abs x) l == 0 then 0 else 1 b = div (abs y) l + if mod (abs y) l == 0 then 0 else 1 c = if y < 0 then 1 else 0 d = if x == 0 then 0 else 1 e = if x == 0 && y < 0 then 1 else 0