"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const X = parseInt(arg[0].split(" ")[0]);
    const K = parseInt(arg[0].split(" ")[1]);
    const D = parseInt(arg[0].split(" ")[2]);
    
    let answer = 0;
    
    // if(X >= 0) {
        // 0までたどり着かない
        if(X - (K * D) > 0) {
            answer = X - (K * D);
            console.log(answer);
            return;
        // 0までたどり着く
        } else {
            let rest = K - Math.ceil(X / D);
            let now = X - (D * Math.ceil(X / D));
            // console.log(rest);
            // console.log(now);

            if(rest % 2 !== 0) {
                now += D; 
            }
            
            console.log(Math.abs(now));
        }
    // }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));