import java.math.BigInteger

fun main(args: Array<String>) {
    val (a, b, c) = readLine()!!.split(" ")
    val now = BigInteger(a).abs()
    val k = BigInteger(b)
    val dist = BigInteger(c)

    var out: BigInteger
    if (now >= k * dist) {
        out = now - (k * dist)
    }
    else {
        val jump = now / dist
        out = now % dist

        if ((k - jump).testBit(0)) {
            out = (out - dist).abs()
        }
    }
    println(out)
}