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;

	if(av_x >= K * D) {
		console.log(av_x - K * D);
	} else {
		for (let i = 1; i <= K; i++) {
			if(av_x < D * i) {
				if(even(i)){
					console.log(D * i - av_x);
				} else {
					console.log(av_x - D * (i - 1));
				}
				break;
			}
		}
	}
};

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