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

if x < 0:
    x = abs(x)

if x - maxi >= 0:
    res = x - maxi
else:
    p = x % d
    m = p - d
    rest = k - (x // d)
    if rest % 2 == 1:
        res = m
    else:
        res = p

print(abs(res)) x, k, d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d maxi = k * d maxi k * d k d res = x res x if x < 0:
    x = abs(x) x < 0 x 0 x = abs(x) x abs(x) abs x if x - maxi >= 0:
    res = x - maxi
else:
    p = x % d
    m = p - d
    rest = k - (x // d)
    if rest % 2 == 1:
        res = m
    else:
        res = p x - maxi >= 0 x - maxi x maxi 0 res = x - maxi res x - maxi x maxi p = x % d p x % d x d m = p - d m p - d p d rest = k - (x // d) rest k - (x // d) k x // d x d if rest % 2 == 1:
        res = m
    else:
        res = p rest % 2 == 1 rest % 2 rest 2 1 res = m res m res = p res p print(abs(res)) print abs(res) abs res k, d = map(int, input().split()) map(int, input().split()) k m = p - d p - d m res = p p res res = x x res res = x - maxi x - maxi res rest = k - (x // d) k - (x // d) rest res = m m res x = abs(x) abs(x) x p = x % d x % d p x, k, d = map(int, input().split()) map(int, input().split()) x d = map(int, input().split()) map(int, input().split()) d maxi = k * d k * d maxi
x, k, d = map(int, input().split())
maxi = k * d
res = x

if x < 0:
    x = abs(x)

if x - maxi >= 0:
    res = x - maxi
else:
    p = x % d
    m = p - d
    rest = k - (x // d)
    if rest % 2 == 1:
        res = m
    else:
        res = p

print(abs(res))