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

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


ans = abs(X) - K * D

if abs(X) - K * D < 0:
    divs = abs(X) // D
    mods = abs(X) % D
    nums = K - divs

    ans = abs(mods - (nums%2) * D)

print(ans)


# ans = min([abs(X+D*i) for i in range(-K, K+1, 2)])
# 
# print(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 ans = abs(X) - K * D ans abs(X) - K * D abs(X) abs X K * D K D if abs(X) - K * D < 0:
    divs = abs(X) // D
    mods = abs(X) % D
    nums = K - divs

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

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


ans = abs(X) - K * D

if abs(X) - K * D < 0:
    divs = abs(X) // D
    mods = abs(X) % D
    nums = K - divs

    ans = abs(mods - (nums%2) * D)

print(ans)


# ans = min([abs(X+D*i) for i in range(-K, K+1, 2)])
# 
# print(ans)
