x, k, d =map(int, input().split()) 
ans = 0; x = abs(x)

if int(x/d) >= k:
	ans = x-d*k
else:
	k = k - int(x/d)
	x = abs(x - d*int(x/d))
	if (k - int(x/d)) % 2 == 1:
		ans = abs(x - d)
	else:
		ans = x


print(ans) x, k, d =map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d ans = 0 ans 0 x = abs(x) x abs(x) abs x if int(x/d) >= k:
	ans = x-d*k
else:
	k = k - int(x/d)
	x = abs(x - d*int(x/d))
	if (k - int(x/d)) % 2 == 1:
		ans = abs(x - d)
	else:
		ans = x int(x/d) >= k int(x/d) int x/d x d k ans = x-d*k ans x-d*k x d*k d k k = k - int(x/d) k k - int(x/d) k int(x/d) int x/d x d x = abs(x - d*int(x/d)) x abs(x - d*int(x/d)) abs x - d*int(x/d) x d*int(x/d) d int(x/d) int x/d x d if (k - int(x/d)) % 2 == 1:
		ans = abs(x - d)
	else:
		ans = x (k - int(x/d)) % 2 == 1 (k - int(x/d)) % 2 k - int(x/d) k int(x/d) int x/d x d 2 1 ans = abs(x - d) ans abs(x - d) abs x - d x d ans = x ans x print(ans) print ans k, d =map(int, input().split()) map(int, input().split()) k x = abs(x) abs(x) x x, k, d =map(int, input().split()) map(int, input().split()) x ans = x-d*k x-d*k ans x = abs(x - d*int(x/d)) abs(x - d*int(x/d)) x ans = 0 0 ans k = k - int(x/d) k - int(x/d) k d =map(int, input().split()) map(int, input().split()) d ans = abs(x - d) abs(x - d) ans ans = x x ans
x, k, d =map(int, input().split()) 
ans = 0; x = abs(x)

if int(x/d) >= k:
	ans = x-d*k
else:
	k = k - int(x/d)
	x = abs(x - d*int(x/d))
	if (k - int(x/d)) % 2 == 1:
		ans = abs(x - d)
	else:
		ans = x


print(ans)
