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

x = abs(x)
g = min(k, x//d)

x -= d*g
k -= g

if k%2 == 0:
    print(x)
else:
    print(abs(x-d)) x,k,d = map(int, input().strip().split(" ")) x map(int, input().strip().split(" ")) map int input().strip().split(" ") ().strip().split ().strip() ().strip () input strip split " " k d x = abs(x) x abs(x) abs x g = min(k, x//d) g min(k, x//d) min k x//d x d x -= d*g x d*g d g k -= g k g if k%2 == 0:
    print(x)
else:
    print(abs(x-d)) k%2 == 0 k%2 k 2 0 print(x) print x print(abs(x-d)) print abs(x-d) abs x-d x d x,k,d = map(int, input().strip().split(" ")) map(int, input().strip().split(" ")) x d = map(int, input().strip().split(" ")) map(int, input().strip().split(" ")) d x = abs(x) abs(x) x g = min(k, x//d) min(k, x//d) g k,d = map(int, input().strip().split(" ")) map(int, input().strip().split(" ")) k x -= d*g d*g x k -= g g k
x,k,d = map(int, input().strip().split(" "))

x = abs(x)
g = min(k, x//d)

x -= d*g
k -= g

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