# ABC172　C - Walking Takahashi

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



q=abs(X)//D

if q>K:

    print((abs(X)-K*D))

else:

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

        print((abs(X)-q*D))

    else:

        print((abs(abs(X)-(q+1)*D)))
# ABC172　C - Walking Takahashi

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



X=abs(X)

q=X//D

if q>K:

    print((X-K*D))

else:

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

        print((X-q*D))

    else:

        print((-X+(q+1)*D))
# ABC172　C - Walking Takahashi
X, K, D = list(map(int, input().split()))
q = abs(X) // D
if q > K:
    print((abs(X) - K * D))
else:
    if (K - q) % 2 == 0:
        print((abs(X) - q * D))
    else:
        print((abs(abs(X) - (q + 1) * D)))

# ABC172　C - Walking Takahashi
X, K, D = list(map(int, input().split()))
X = abs(X)
q = X // D
if q > K:
    print((X - K * D))
else:
    if (K - q) % 2 == 0:
        print((X - q * D))
    else:
        print((-X + (q + 1) * D))

-q = abs(X) // D +X = abs(X) +q = X // D -    print((abs(X) - K * D)) +    print((X - K * D)) -        print((abs(X) - q * D)) +        print((X - q * D)) -        print((abs(abs(X) - (q + 1) * D))) +        print((-X + (q + 1) * D))