// 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;
    }
    long dir = (0 < X) ? -1 : 1;
    long base = X + ((K & 1) ? D * dir : 0);
    long d = D * 2;
    long k = K - (K & 1);
    long ok = 0;
    long ng = k / 2 + 1;
    while ((ng - ok) > 1)
    {
        long m = (ok + ng) / 2;
        if ((base < 0) == (BigInt(base) + BigInt(m) * BigInt(d) * dir < 0))
        {
            ok = m;
        }
        else
        {
            ng = m;
        }
    }
    // writeln(ok);
    // writeln(base);
    BigInt ans = BigInt(base) - dir;
    if (ans < 0)
        ans = -ans;
    foreach (i; -10 .. 10)
    {
        if (0 <= ok + i && ok + i < k)
        {
            auto tmp = BigInt(base) + BigInt(ok + i) * d * dir;
            // writeln(i + ok);
            // writeln(tmp);
            if (tmp < 0)
                tmp = -tmp;
            if (tmp < ans)
                ans = tmp;
        }
    }
    writeln(ans);
}
