function Main(input) {
  const row = input.split(" ");
    	let X = parseInt(row[0], 10);
    	let K = parseInt(row[1], 10);
    	const D = parseInt(row[2], 10);
    let absX = Math.abs(X);
    let a = Math.floor(absX / D);
    let ans;

    if((absX /D) >= K) {
       ans = absX - D * K;

    } else {
       K2 = K - a;
       absX = absX - K2 * D;
       if(K2 % 2 === 1) {
    　ans = absX - D;
      } else {
         ans = absX;
      }
    } console.log(Math.abs(ans));
}

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