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


def sign(x):
    return 1 if x >= 0 else -1


if abs(X) >= D * K:
    ans = X - sign(X) * D * K
else:
    l = abs(X) // D
    mod = abs(X) % D

    residual = K - l

    if residual % 2 == 0:
        ans = mod
    else:
        ans = mod - sign(mod) * D

print(abs(ans))

 X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D def sign(x):
    return 1 if x >= 0 else -1 sign return 1 if x >= 0 else -1 1 if x >= 0 else -1 x >= 0 x 0 1 -1 x x if abs(X) >= D * K:
    ans = X - sign(X) * D * K
else:
    l = abs(X) // D
    mod = abs(X) % D

    residual = K - l

    if residual % 2 == 0:
        ans = mod
    else:
        ans = mod - sign(mod) * D abs(X) >= D * K abs(X) abs X D * K D K ans = X - sign(X) * D * K ans X - sign(X) * D * K X sign(X) * D * K sign(X) * D sign(X) sign X D K l = abs(X) // D l abs(X) // D abs(X) abs X D mod = abs(X) % D mod abs(X) % D abs(X) abs X D residual = K - l residual K - l K l if residual % 2 == 0:
        ans = mod
    else:
        ans = mod - sign(mod) * D residual % 2 == 0 residual % 2 residual 2 0 ans = mod ans mod ans = mod - sign(mod) * D ans mod - sign(mod) * D mod sign(mod) * D sign(mod) sign mod D print(abs(ans)) print abs(ans) abs ans K, D = map(int, input().split()) map(int, input().split()) K D = map(int, input().split()) map(int, input().split()) D def sign(x):
    return 1 if x >= 0 else -1 def sign(x):
    return 1 if x >= 0 else -1 sign mod = abs(X) % D abs(X) % D mod X, K, D = map(int, input().split()) map(int, input().split()) X l = abs(X) // D abs(X) // D l ans = X - sign(X) * D * K X - sign(X) * D * K ans residual = K - l K - l residual ans = mod - sign(mod) * D mod - sign(mod) * D ans ans = mod mod ans
X, K, D = map(int, input().split())


def sign(x):
    return 1 if x >= 0 else -1


if abs(X) >= D * K:
    ans = X - sign(X) * D * K
else:
    l = abs(X) // D
    mod = abs(X) % D

    residual = K - l

    if residual % 2 == 0:
        ans = mod
    else:
        ans = mod - sign(mod) * D

print(abs(ans))


