Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function Main(input) {
    tmp = input.split(" ");
    x = parseInt(tmp[0], 10);
    k = parseInt(tmp[1], 10);
    d = parseInt(tmp[2], 10);
    count = 0;
    count += Math.floor(Math.abs(x) / d);


    if (count > k) {
        count = k;
    }

    if (x > 0) {
       x =  x - (d * count);
    } else{
        x =  x + (d * count);
    }

    if (count <= k) {
        if ((k - count) % 2 == 0) {
        
        } else{
            if (x > 0) {
                x =  x - d;
             } else{
                 x =  x + d;
             }
        }
    }


    console.log(Math.abs(x));
    



}