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

cur  = abs(x)
rem = k

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

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

cur  = abs(x)
rem = k

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

if rem  > 0:
        if rem % 2 == 1:
                cur = cur - d
                
ans = abs(cur)
print(ans)