function MainC(input){
    const [X, K, D] = input.split(' ').map(Number);
    let curr = X;
    let minusNum = 0;
    const iniPlusFlg = (curr>=0);

    for(let i=0; i<K; i++){
        curr = (curr>=0) ? curr-D : curr+D;
        if(iniPlusFlg && curr<0){
            minusNum = curr;
        }
        if(!iniPlusFlg && curr>0){
            minusNum = curr;
        }
        if(minusNum && curr>=0) {
            curr = Math.min(Math.abs(minusNum),curr);
            if((K-(i+1)) % 2 == 0){
                break;
            } else {
                curr -= D;
                break;
            }
        }
    }
    console.log(Math.abs(curr));
}
MainC(require("fs").readFileSync("/dev/stdin", "utf8").trim());
