function Main(input) {
  input = input.split(" ");
  
  var x = parseInt(input[0], 10);
  var k = parseInt(input[1], 10);
  var d = parseInt(input[2], 10);
  
  var length = x;
  var tmp = x;
  var i;
  
  k%2==0 ? i=0 : 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"));