solve :: [Int] -> Int
solve [x,k,d]
 | even exceededNumberOfWalking = abs (absX - numberOfWalking * d)
 | otherwise                    = abs (absX - (numberOfWalking + 1) * d)
  where absX = abs x
        numberOfWalking = min k (absX `div` d)
        exceededNumberOfWalking = k - numberOfWalking
main = print =<< solve . map read . words <$> getLine