import scala.math.BigInt.long2bigInt

object Main extends App {
  val params = io.StdIn.readLine().split(" ").map(_.toLong)
  var x = params(0)
  var k = params(1)
  var d = params(2)
  var ans: Long = 0

  x = Math.abs(x)
  if (x - k * d > 0)
    ans = x - k * d
  else {
    val y = x / d
    if (((k - y) mod 2) == 0) {
      ans = x - y * d
    } else {
      ans = Math.abs(x - (y + 1) * d)
    }
  }
  println(ans)
}
