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

n = (K-X//D)//2

#print(n)

if X - K*D > 0:

    ans = X-K*D

elif X + D*K < 0:

    ans = abs(X+D*K)

else:

    ans = float('inf')

    for i in range(-1, 2):

        res = X + D*(K-2*(n+i))

        ans = min(ans, abs(res))

    for i in range(-1, 2):

        res = X + D*(2*(n+i)-K)

        ans = min(ans, abs(res))

        #print(res)



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

n = (K-X//D)//2

#print(n)

if X - K*D > 0:

    ans = X-K*D

elif X + D*K < 0:

    ans = abs(X+D*K)

else:

    ans = float('inf')

    for i in range(-1, 2):

        res = X + D*(2*(n+i)-K)

        ans = min(ans, abs(res))

        #print(res)



print(ans)
X, K, D = list(map(int, input().split()))
n = (K - X // D) // 2
# print(n)
if X - K * D > 0:
    ans = X - K * D
elif X + D * K < 0:
    ans = abs(X + D * K)
else:
    ans = float("inf")
    for i in range(-1, 2):
        res = X + D * (K - 2 * (n + i))
        ans = min(ans, abs(res))
    for i in range(-1, 2):
        res = X + D * (2 * (n + i) - K)
        ans = min(ans, abs(res))
        # print(res)
print(ans)

X, K, D = list(map(int, input().split()))
n = (K - X // D) // 2
# print(n)
if X - K * D > 0:
    ans = X - K * D
elif X + D * K < 0:
    ans = abs(X + D * K)
else:
    ans = float("inf")
    for i in range(-1, 2):
        res = X + D * (2 * (n + i) - K)
        ans = min(ans, abs(res))
        # print(res)
print(ans)

-        res = X + D * (K - 2 * (n + i)) -        ans = min(ans, abs(res)) -    for i in range(-1, 2):