import kotlin.math.absoluteValue

fun main() {
    val (x, k, d) = readLine()!!.trim().split(' ').map(String::toLong)

    val step = x.absoluteValue / d
    val pos = x.absoluteValue % d
    if (step >= k) {
        println(x.absoluteValue - k * d)
    }else {
        val rest = (k - step) % 2
        println(
            if (rest == 0L) pos
            else (pos - d).absoluteValue
        )
    }
}