# C - Walking Takahashi

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

x = abs(x)

if x > d * k:
    print(x - d * k)
    exit()

k -= x // d
x %= d

print(x if k % 2 == 0 else d - 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 if x > d * k:
    print(x - d * k)
    exit() x > d * k x d * k d k print(x - d * k) print x - d * k x d * k d k exit() exit k -= x // d k x // d x d x %= d x d print(x if k % 2 == 0 else d - x) print x if k % 2 == 0 else d - x k % 2 == 0 k % 2 k 2 0 x d - x d x x, k, d = map(int, input().split()) map(int, input().split()) x d = map(int, input().split()) map(int, input().split()) d x = abs(x) abs(x) x k -= x // d x // d k x %= d d x k, d = map(int, input().split()) map(int, input().split()) k
# C - Walking Takahashi

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

x = abs(x)

if x > d * k:
    print(x - d * k)
    exit()

k -= x // d
x %= d

print(x if k % 2 == 0 else d - x)
