import kotlin.math.abs

fun main() {
    val (X, K, D) = readLine()!!.split(" ").map { it.toLong() }
    var x = abs(X)
    var k = K

    while (k > 0) {
        var p = if (k > x / D) {
            x / D
        } else {
            k
        }
        if (p == 0L) {
            break
        }
        x -= p * D
        k -= p
        x = abs(x)
    }
    x = if (k % 2 == 0L) {
        x
    } else {
        abs(x - D)
    }

    println(x)
}