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

x = abs(x)

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

x = abs(x)

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