module Main where

import System.Environment

-- note: asks for smallest ABSOLUTE value
main :: IO ()
main = do
        (x:k:d:_) <- fmap (map read . words) $ getLine
        putStrLn . show $ case k `mod` 2 of
                1 -> minimum . map abs $ [x - d * i | i <- [-k..k]]
                0 -> minimum . map abs $ [x - d * 2 * i | i <- [-(k `div` 2) .. (k `div` 2)]]
