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

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

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