function Main(input) {
  input = input.split(" ");

  var x = parseInt(input[0], 10);
  var k = parseInt(input[1], 10);
  var d = parseInt(input[2], 10);

  if (x < 0) {
    x = -x;
  }

  var length = x;
  var tmp = x;

  if (k % 2 == 0) {
    var i = 0
  } else {
    var i = 1
  }

  for (i; i <= k; i += 2) {
    tmp = length - (d * i);
    if (Math.abs(tmp) <= Math.abs(length)) {
      length = tmp;
    } else {
      break;
    }
  }

  console.log(Math.abs(length));
}

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