import kotlin.math.abs

fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main() {
    val (x, k, d) = longList()
    val xx = abs(x)
    val v = xx / d
    val a = xx - d * v
    val b = xx - (d * (v + 1))
    if (v < k) {
        if ((k - v) % 2 == 1L) {
            println(abs(b).toString())
        } else {
            println(abs(a).toString())
        }
    } else {
        println(abs(xx - (d * k)).toString())
    }
}