import Control.Monad
import Data.Function
import Data.Char
import Data.List
import Text.Read
import Text.ParserCombinators.ReadPrec
import Text.Printf

import Data.Ratio
import Data.Maybe

newtype Pair a b = Pair { getPair :: (a, b) }

instance (Read a, Read b) => Read (Pair a b) where
  readPrec = Pair `dot` (,) <$> readPrec <* get <*> readPrec

instance (Show a, Show b) => Show (Pair a b) where
  show (Pair (a, b)) = show a ++ " " ++ show b

readPair :: IO (Int, Int)
readPair = getPair <$> readLn

infixr 8 `dot`
dot :: (c -> d) -> (a -> b -> c) -> a -> b -> d
dot = ((.).(.))

main :: IO ()
main = do
  [x, k, d] <- map read . words <$> getLine
  case solve x k d of
    Just ans -> print ans
    _        -> return ()

solve :: Int -> Int -> Int -> Maybe Int
solve x k d
  | k < 0  = Nothing
  | d <= 0 = Nothing
  | k == 0 = Just $ abs x
  | x > 0  = solve (x - d) (k - 1) d
  | x <= 0 = solve (x + d) (k - 1) d
