function Main(input) {
	const row = input.split(" ");
	const X = parseInt(row[0], 10);
	const K = parseInt(row[1], 10);
	const D = parseInt(row[2], 10);
	const even = num => num % 2 === 0;
	const av_x = X < 0 ? X * -1 : X;
	const cnt = av_x / D;

	if(cnt >= K) {
		console.log(av_x - K * D);
	} else {
		if(even(K - Math.floor(cnt))){
			console.log(av_x - D * Math.floor(cnt));
		} else {
			console.log(D * (Math.floor(cnt) + 1) - av_x);
		}
	}
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
