import kotlin.math.abs

fun main() {
    val (x, k, d) = readStrings().map { abs(it.toLong()) }

    val toZero = x / d
    if (toZero < k) {
        val y = x - toZero * d
        val rem = k - toZero
        val yd = d - y
        println(if (rem % 2 == 1L) yd else y)
    } else println(x - k * d)
}

// Input Reader
private fun readLn() = readLine()!!

private fun readStrings() = readLn().trim().split(" ")
