X,K,D=list(map(int,input().split()))

kai = 0

xy = abs(X)

if xy >= K*D:

    kotae = abs(xy-(K*D))

if xy < K*D:

    kai, mod = divmod(xy, D)

    ds = kai*D

    if (K-kai)%2==0:

        kotae = abs(xy-ds)

    if (K-kai)%2!=0:

        kotae = abs(xy-ds-D)

print(kotae)
X,K,D=list(map(int,input().split()))

zettaitix = abs(X)

if zettaitix >= K*D:

    kotae = abs(zettaitix-(K*D))

elif zettaitix < K*D:

    kai, mod = divmod(zettaitix, D)

    ds = kai*D

    if (K-kai)%2==0:

        kotae = abs(zettaitix-ds)

    elif (K-kai)%2!=0:

        kotae = abs(zettaitix-ds-D)

print(kotae)
X, K, D = list(map(int, input().split()))
kai = 0
xy = abs(X)
if xy >= K * D:
    kotae = abs(xy - (K * D))
if xy < K * D:
    kai, mod = divmod(xy, D)
    ds = kai * D
    if (K - kai) % 2 == 0:
        kotae = abs(xy - ds)
    if (K - kai) % 2 != 0:
        kotae = abs(xy - ds - D)
print(kotae)

X, K, D = list(map(int, input().split()))
zettaitix = abs(X)
if zettaitix >= K * D:
    kotae = abs(zettaitix - (K * D))
elif zettaitix < K * D:
    kai, mod = divmod(zettaitix, D)
    ds = kai * D
    if (K - kai) % 2 == 0:
        kotae = abs(zettaitix - ds)
    elif (K - kai) % 2 != 0:
        kotae = abs(zettaitix - ds - D)
print(kotae)

-kai = 0 -xy = abs(X) -if xy >= K * D: -    kotae = abs(xy - (K * D)) -if xy < K * D: -    kai, mod = divmod(xy, D) +zettaitix = abs(X) +if zettaitix >= K * D: +    kotae = abs(zettaitix - (K * D)) +elif zettaitix < K * D: +    kai, mod = divmod(zettaitix, D) -        kotae = abs(xy - ds) -    if (K - kai) % 2 != 0: -        kotae = abs(xy - ds - D) +        kotae = abs(zettaitix - ds) +    elif (K - kai) % 2 != 0: +        kotae = abs(zettaitix - ds - D)