import Data.List
import Data.Char
import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as BS8
import qualified Data.Vector as Vector
import Data.Vector ((!))

main :: IO ()
main = do
  [x, k, d] <- unfoldr (BS8.readInt . BS8.dropWhile isSpace) <$> BS8.getLine

  let
    (n, m) = x `divMod` d
    c = if x < 0 then 1 else 0
    o = [m, minimum $ map abs [m - d, m + d]]
    ans = abs $ if k >= (n - c) then o !! ((k - n - c) `mod` 2)
      else minimum $ map abs [x + k * d, x - k * d]

  print ans
