import scala.util.control.Breaks

object Main extends App {
  val xkdInput = scala.io.StdIn.readLine()
  val xkdArray = xkdInput.split(" ").map(_.toLong).toVector

  val x = xkdArray(0)
  val k = xkdArray(1)
  val d = xkdArray(2)

  var tempK = k
  var tempMin = x

  val b1 = new Breaks
  b1.breakable {
    while(true) {
      if (tempMin < 0) {
        val temp2 = tempMin + d
        if (Math.abs(temp2) < Math.abs(tempMin)) {
          tempK = tempK - 1
          tempMin = temp2
          if(tempK == 0) {
            b1.break
          }
        } else {
          b1.break
        }
      } else if(tempMin > 0) {
        val temp2 = tempMin - d
        if (Math.abs(temp2) < Math.abs(tempMin)) {
          tempK = tempK - 1
          tempMin = temp2
          if(tempK == 0) {
            b1.break
          }
        } else {
          b1.break
        }
      } else {
        b1.break
      }
    }
  }

  if(tempK == 0) {
    println(Math.abs(tempMin))
  } else if (tempK % 2 == 0) {
    println(Math.abs(tempMin))
  } else {
    if (tempMin < 0) {
      println(Math.abs(tempMin + d))
    } else {
      println(Math.abs(tempMin - d))
    }
  }
}