x, k, d = map(int, input().split())
x = abs(x)

k_ = min(k, x // d)
k = k - k_
x = x-k_*d

if k % 2 != 0:
    x = abs(x-d)
print(x) x, k, d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d x = abs(x) x abs(x) abs x k_ = min(k, x // d) k_ min(k, x // d) min k x // d x d k = k - k_ k k - k_ k k_ x = x-k_*d x x-k_*d x k_*d k_ d if k % 2 != 0:
    x = abs(x-d) k % 2 != 0 k % 2 k 2 0 x = abs(x-d) x abs(x-d) abs x-d x d print(x) print x x, k, d = map(int, input().split()) map(int, input().split()) x k = k - k_ k - k_ k k_ = min(k, x // d) min(k, x // d) k_ x = abs(x-d) abs(x-d) x k, d = map(int, input().split()) map(int, input().split()) k d = map(int, input().split()) map(int, input().split()) d x = abs(x) abs(x) x x = x-k_*d x-k_*d x
x, k, d = map(int, input().split())
x = abs(x)

k_ = min(k, x // d)
k = k - k_
x = x-k_*d

if k % 2 != 0:
    x = abs(x-d)
print(x)
