function Main(input){
  const 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);

  for(let i = 1; i <= k; i++) {
    if(moveA > moveB) {
       X = X - D;
        moveB = Math.abs(X - D);
        moveA = Math.abs(X + D);
    } else {
      X = X + D;
      moveA = Math.abs(X + D);
      moveB = Math.abs(X - X);
    }
  }
  console.log(X);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
