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

if X + K * D <= 0:

    print((-X - K * D))

elif X - K * D >= 0:

    print((X - K * D))

else:

    div = X // D

    mod = X % D

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

        print(mod)

    else:

        print((abs(mod-D)))

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

if X + K * D <= 0:

    print((-X - K * D))

elif X - K * D >= 0:

    print((X - K * D))

else:

    div = abs(X) // D

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

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

    else:

        print((abs(abs(X) - D * (div + 1))))

X, K, D = list(map(int, input().split()))
if X + K * D <= 0:
    print((-X - K * D))
elif X - K * D >= 0:
    print((X - K * D))
else:
    div = X // D
    mod = X % D
    if (K - div) % 2 == 0:
        print(mod)
    else:
        print((abs(mod - D)))

X, K, D = list(map(int, input().split()))
if X + K * D <= 0:
    print((-X - K * D))
elif X - K * D >= 0:
    print((X - K * D))
else:
    div = abs(X) // D
    if (K - div) % 2 == 0:
        print((abs(X) - D * div))
    else:
        print((abs(abs(X) - D * (div + 1))))

-    div = X // D -    mod = X % D +    div = abs(X) // D -        print(mod) +        print((abs(X) - D * div)) -        print((abs(mod - D))) +        print((abs(abs(X) - D * (div + 1))))