const main = (input) => {
  let [x, k, d] = input.trim().split(' ').map(BigInt)

  const m = k > x/d ? x/d : k
  x -= m * d
  k -= m

  if (k % 2n === 0n) return console.log(`${x}`)
  else {
    const a = x+d >= 0n ? x+d : (x+d) * -1n
    const b = x-d >= 0n ? x-d : (x-d) * -1n
    return console.log(a > b ? `${b}` : `${a}`)
  }
}

process.env.MYTEST ? test() : main(require('fs').readFileSync('/dev/stdin', 'utf8'))