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

x = -x if x <= 0 else x

if x - d * k >= 0:
    print(x - d * k)
else:
    a = x // d
    b = a + 1
    rest_cnt = k - a
    if rest_cnt % 2 == 0:
        print(abs(x - d * a))
    else:
        print(abs(x - d * b)) x, k, d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d x = -x if x <= 0 else x x -x if x <= 0 else x x <= 0 x 0 -x x x if x - d * k >= 0:
    print(x - d * k)
else:
    a = x // d
    b = a + 1
    rest_cnt = k - a
    if rest_cnt % 2 == 0:
        print(abs(x - d * a))
    else:
        print(abs(x - d * b)) x - d * k >= 0 x - d * k x d * k d k 0 print(x - d * k) print x - d * k x d * k d k a = x // d a x // d x d b = a + 1 b a + 1 a 1 rest_cnt = k - a rest_cnt k - a k a if rest_cnt % 2 == 0:
        print(abs(x - d * a))
    else:
        print(abs(x - d * b)) rest_cnt % 2 == 0 rest_cnt % 2 rest_cnt 2 0 print(abs(x - d * a)) print abs(x - d * a) abs x - d * a x d * a d a print(abs(x - d * b)) print abs(x - d * b) abs x - d * b x d * b d b b = a + 1 a + 1 b d = map(int, input().split()) map(int, input().split()) d x, k, d = map(int, input().split()) map(int, input().split()) x x = -x if x <= 0 else x -x if x <= 0 else x x a = x // d x // d a k, d = map(int, input().split()) map(int, input().split()) k rest_cnt = k - a k - a rest_cnt
x, k, d = map(int, input().split())

x = -x if x <= 0 else x

if x - d * k >= 0:
    print(x - d * k)
else:
    a = x // d
    b = a + 1
    rest_cnt = k - a
    if rest_cnt % 2 == 0:
        print(abs(x - d * a))
    else:
        print(abs(x - d * b))
