
import scala.io.StdIn

object Main extends App {
  val Array(x,k,d):Array[Long] = StdIn.readLine().split(' ').map(_.toLong)
  val stepToZeroNbhd = x / d
  val ans =
    if(stepToZeroNbhd >= k)
      x - math.signum(x)*d*k
    else{
      val x2=x - math.signum(x)*d*stepToZeroNbhd
      val kRemaining=k-stepToZeroNbhd
      if(kRemaining % 2 == 0 )
        x2
      else {
        val sgn = if(x2==0) 1 else math.signum(x2)
        x2 - sgn*d
      }
    }

  println(math.abs(ans))

}






