import java.util.Scanner
import kotlin.math.*

fun main() {
	val scn = Scanner(System.`in`)
	val x = scn.nextLong()
	val k = scn.nextLong()
	val d = scn.nextLong()
	if (k<abs(x)/d) {
		println(abs(x)-(d*k))
	}else {
		val a = abs(x) % d
		val r = (k - abs(x)/d) % 2
		when(r){
			0L -> println(a)
			else -> println(d-a)
		}
	}
}
