function Main(input) {
  var row = input.split(" ");
  	var X = parseInt(row[0], 10);
  	const K = parseInt(row[1], 10);
  	const D = parseInt(row[2], 10);
  var moveA = Math.abs(X + D);
  var moveB = Math.abs(X - D);
  var array = [];

  for(let i = 1; i <= K; i++) {

    if(moveA > moveB) {
       X -= D;
       array.push(Math.abs(X));
        moveA = Math.abs(X + D);
        moveB = Math.abs(X - D);

    } else {
      X += D;
      array.push(Math.abs(X));
      moveA = Math.abs(X + D);
      moveB = Math.abs(X - D);
    }
  }
  console.log(Math.min.apply(null, array));//if文で整理した配列から最小値を取る。
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
