// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std, core.bitop;
// dfmt on
void main()
{
    auto input = stdin.byLine.map!split.joiner;

    long X;
    X = input.front.to!long;
    input.popFront;

    long K;
    K = input.front.to!long;
    input.popFront;

    long D;
    D = input.front.to!long;
    input.popFront;

    solve(X, K, D);
}

void solve(long X, long K, long D)
{
    if (K * D < abs(X))
    {
        writeln(abs(X) - abs(K * D));
        return;
    }
    if (K & 1)
    {
        min(solve2(X + D, K - 1, D), solve2(X - D, K - 1, D)).writeln();
    }
    else
    {
        solve2(X, K, D).writeln();
    }
}

long solve2(long X, long K, long D)
{
    long dir = (X < 0) ? 1 : -1;
    long k = K / 2;
    long d = D * 2;
    long ok = 0;
    long ng = k + 1;
    while (ng - ok > 1)
    {
        long m = (ok + ng) / 2;
        auto b = BigInt(X) + BigInt(d) * m * dir;
        auto c = BigInt(X) + BigInt(d) * (m + 1) * dir;
        if (b < 0)
            b = -b;
        if (c < 0)
            c = -c;
        if (c < b)
        {
            ok = m;
        }
        else
        {
            ng = m;
        }
    }
    BigInt ans = BigInt(abs(X));
    foreach (i; -10 .. 10)
        if (0 <= ok + i && ok + i <= k)
        {
            auto b = BigInt(X) + BigInt(d) * (ok + i) * dir;
            if (b < 0)
                b = -b;
            if (b < ans)
                ans = b;
        }
    return ans.toLong();
}
