x, k, d = [int(x) for x in input().split(' ')]
x = abs(x)

q = x // d
r = x % d

if k >= q:
    if k%2 == q%2:
        print(r)
    else:
        print(d - r)
else:
    print(x - d*k) int(x) for x in input().split(' ') for x in input().split(' ') x input().split(' ') ().split () input split ' ' for x in input().split(' ') int(x) int x x, k, d = [int(x) for x in input().split(' ')] x [int(x) for x in input().split(' ')] k d x = abs(x) x abs(x) abs x q = x // d q x // d x d r = x % d r x % d x d if k >= q:
    if k%2 == q%2:
        print(r)
    else:
        print(d - r)
else:
    print(x - d*k) k >= q k q if k%2 == q%2:
        print(r)
    else:
        print(d - r) k%2 == q%2 k%2 k 2 q%2 q 2 print(r) print r print(d - r) print d - r d r print(x - d*k) print x - d*k x d*k d k k, d = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] k x = abs(x) abs(x) x q = x // d x // d q x, k, d = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] x r = x % d x % d r d = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] d
x, k, d = [int(x) for x in input().split(' ')]
x = abs(x)

q = x // d
r = x % d

if k >= q:
    if k%2 == q%2:
        print(r)
    else:
        print(d - r)
else:
    print(x - d*k)