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

cur = abs(x)
rem = k

cnt = min(cur // d, k)
cur -= d * cnt
rem -= cnt

if rem > 0:
    if rem % 2 == 1:
        cur -= d

ans = abs(cur)
print(ans) x, k, d = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d cur = abs(x) cur abs(x) abs x rem = k rem k cnt = min(cur // d, k) cnt min(cur // d, k) min cur // d cur d k cur -= d * cnt cur d * cnt d cnt rem -= cnt rem cnt if rem > 0:
    if rem % 2 == 1:
        cur -= d rem > 0 rem 0 if rem % 2 == 1:
        cur -= d rem % 2 == 1 rem % 2 rem 2 1 cur -= d cur d ans = abs(cur) ans abs(cur) abs cur print(ans) print ans cur -= d * cnt d * cnt cur rem = k k rem x, k, d = map(int,input().split()) map(int,input().split()) x rem -= cnt cnt rem cur = abs(x) abs(x) cur cnt = min(cur // d, k) min(cur // d, k) cnt cur -= d d cur ans = abs(cur) abs(cur) ans d = map(int,input().split()) map(int,input().split()) d k, d = map(int,input().split()) map(int,input().split()) k
x, k, d = map(int,input().split())

cur = abs(x)
rem = k

cnt = min(cur // d, k)
cur -= d * cnt
rem -= cnt

if rem > 0:
    if rem % 2 == 1:
        cur -= d

ans = abs(cur)
print(ans)