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.readInteger . BS8.dropWhile isSpace) <$> BS8.getLine

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

  print ans
