x, k, d = map(int, input().split())
if abs(x) // d >= k:
    if x > 0:
        print(x - k * d)
    else:
        print(abs(k * d + x))
    exit()
div = abs(x) // d
k -= div
if x > 0:
    x -= div * d
else:
    x += div * d
if k % 2 == 0:
    print(abs(x))
else:
    print(abs(abs(x) - d)) x, k, d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d if abs(x) // d >= k:
    if x > 0:
        print(x - k * d)
    else:
        print(abs(k * d + x))
    exit() abs(x) // d >= k abs(x) // d abs(x) abs x d k if x > 0:
        print(x - k * d)
    else:
        print(abs(k * d + x))
     x > 0 x 0 print(x - k * d) print x - k * d x k * d k d print(abs(k * d + x)) print abs(k * d + x) abs k * d + x k * d k d x exit() exit div = abs(x) // d div abs(x) // d abs(x) abs x d k -= div k div if x > 0:
    x -= div * d
else:
    x += div * d x > 0 x 0 x -= div * d x div * d div d x += div * d x div * d div d if k % 2 == 0:
    print(abs(x))
else:
    print(abs(abs(x) - d)) k % 2 == 0 k % 2 k 2 0 print(abs(x)) print abs(x) abs x print(abs(abs(x) - d)) print abs(abs(x) - d) abs abs(x) - d abs(x) abs x d d = map(int, input().split()) map(int, input().split()) d x -= div * d div * d x x, k, d = map(int, input().split()) map(int, input().split()) x x += div * d div * d x div = abs(x) // d abs(x) // d div k -= div div k k, d = map(int, input().split()) map(int, input().split()) k
x, k, d = map(int, input().split())
if abs(x) // d >= k:
    if x > 0:
        print(x - k * d)
    else:
        print(abs(k * d + x))
    exit()
div = abs(x) // d
k -= div
if x > 0:
    x -= div * d
else:
    x += div * d
if k % 2 == 0:
    print(abs(x))
else:
    print(abs(abs(x) - d))
