x,k,d=list(map(int,input().split()))





if d>=abs(x):

    if k%2==0:

        p=abs(x)

    else:

        if x>=0:

            p=abs(x-d)

        else:

            p=abs(x+d)

    print(p)

    exit(0)

else:

    cnt=abs(x)//d



    if cnt>=k:

        cnt=k



    if x>=0:

        p=x-d*cnt

    else:

        p=x+d*cnt



    k-=cnt



    if k==0:

        print((abs(p)))

        exit(0)



    if k%2==0:

        print((abs(p)))

    else:

        if p>=0:

            p=abs(p-d)

        else:

            p=abs(p+d)



        print(p)
x,k,d=list(map(int,input().split()))



x=abs(x)



cnt=abs(x)//d





if cnt>=k:

    print((x-d*k))

else:

    k-=cnt



    if k%2==0:

        print((abs(x-d*cnt)))

    else:

        print((abs(x-d*(cnt+1))))



x, k, d = list(map(int, input().split()))
if d >= abs(x):
    if k % 2 == 0:
        p = abs(x)
    else:
        if x >= 0:
            p = abs(x - d)
        else:
            p = abs(x + d)
    print(p)
    exit(0)
else:
    cnt = abs(x) // d
    if cnt >= k:
        cnt = k
    if x >= 0:
        p = x - d * cnt
    else:
        p = x + d * cnt
    k -= cnt
    if k == 0:
        print((abs(p)))
        exit(0)
    if k % 2 == 0:
        print((abs(p)))
    else:
        if p >= 0:
            p = abs(p - d)
        else:
            p = abs(p + d)
        print(p)

x, k, d = list(map(int, input().split()))
x = abs(x)
cnt = abs(x) // d
if cnt >= k:
    print((x - d * k))
else:
    k -= cnt
    if k % 2 == 0:
        print((abs(x - d * cnt)))
    else:
        print((abs(x - d * (cnt + 1))))

-if d >= abs(x): +x = abs(x) +cnt = abs(x) // d +if cnt >= k: +    print((x - d * k)) +else: +    k -= cnt -        p = abs(x) +        print((abs(x - d * cnt))) -        if x >= 0: -            p = abs(x - d) -        else: -            p = abs(x + d) -    print(p) -    exit(0) -else: -    cnt = abs(x) // d -    if cnt >= k: -        cnt = k -    if x >= 0: -        p = x - d * cnt -    else: -        p = x + d * cnt -    k -= cnt -    if k == 0: -        print((abs(p))) -        exit(0) -    if k % 2 == 0: -        print((abs(p))) -    else: -        if p >= 0: -            p = abs(p - d) -        else: -            p = abs(p + d) -        print(p) +        print((abs(x - d * (cnt + 1))))