function main(input){
  input = input.split('\n');
  let [X, K, D] = input[0].split(' ').map(BigInt);

  let n = X/D;
  if(n < 0n) n = -n;

  if(K >= n){
    if(X > 0n)X -= n*D;
    else X += n*D;
    K -= n

    if (K%2n != 0n){
      if(X >= 0n){
        X -= D;
      }else{
        X += D;
      }
    }
  }else {
    if(X > 0n)X -= K*D;
    else X += K*D;
    K -= n
  }

  console.log(X >= 0n? String(X) : String(-X))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8').trim());
