import kotlin.math.abs
import kotlin.math.min

object Solve {

  const val INF = (10E17).toLong()

  fun solve() {

    var (x, k, d) = readLine()!!.split(' ').map { it.toLong() }

    x = abs(x)

    val mnum = min(x / d, k)
    k -= mnum
    x -= mnum * d

    val cand = x - (k * d)

    var ans = if (k % 2L == 0L) x else d - x

    println(ans)
  }
}

fun main(args: Array<String>) {
  Solve.solve()
}