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;
  
  if(k%2 == 0){
  	for(var i = 0; i <= k; i+=2){
    	tmp = length - (d*i);
      	if(Math.abs(tmp) <= Math.abs(length)){
        	length = tmp;
        }else{
        	break;
        }
    }
  }else{
  	for(var i = 1; 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"));