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