-- https://github.com/minoki/my-atcoder-solutions
import Data.Char (isSpace)
import Data.Int (Int64)
import Data.List (unfoldr)
import qualified Data.ByteString.Char8 as BS

naive :: Integer -> Integer -> Integer -> Integer
naive x k d = minimum $ map abs $ do
  let loop 0 t = pure t
      loop i t = do
        u <- oneStep t
        loop (i - 1) u
  loop k x
  where
    oneStep :: Integer -> [Integer]
    oneStep t = [t - d, t + d]

main = do
  [x,k,d] <- map fromInteger . unfoldr (BS.readInteger . BS.dropWhile isSpace) <$> BS.getLine
  print $ naive x k d
