import numpy as np

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

x = np.abs(x)

if x - k * d > 0:
	print(x - k * d)
elif x == d:
	if k % 2 == 0: print(x)
	else:print(0)
else:
	times = k - x // d
	num1 = x % d
	num2 = num1 - d
	if times % 2 == 0:
		print(np.abs(num1))
	else:
		print(np.abs(num2)) import numpy as np numpy x,k,d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d x = np.abs(x) x np.abs(x) np.abs np abs x if x - k * d > 0:
	print(x - k * d)
elif x == d:
	if k % 2 == 0: print(x)
	else:print(0)
else:
	times = k - x // d
	num1 = x % d
	num2 = num1 - d
	if times % 2 == 0:
		print(np.abs(num1))
	else:
		print(np.abs(num2)) 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 elif x == d:
	if k % 2 == 0: print(x)
	else:print(0) x == d x d if k % 2 == 0: print(x)
	else:print(0) k % 2 == 0 k % 2 k 2 0 times = k - x // d times k - x // d k x // d x d num1 = x % d num1 x % d x d num2 = num1 - d num2 num1 - d num1 d if times % 2 == 0:
		print(np.abs(num1))
	else:
		print(np.abs(num2)) times % 2 == 0 times % 2 times 2 0 print(np.abs(num1)) print np.abs(num1) np.abs np abs num1 print(np.abs(num2)) print np.abs(num2) np.abs np abs num2 num2 = num1 - d num1 - d num2 x = np.abs(x) np.abs(x) x d = map(int, input().split()) map(int, input().split()) d num1 = x % d x % d num1 k,d = map(int, input().split()) map(int, input().split()) k x,k,d = map(int, input().split()) map(int, input().split()) x times = k - x // d k - x // d times
import numpy as np

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

x = np.abs(x)

if x - k * d > 0:
	print(x - k * d)
elif x == d:
	if k % 2 == 0: print(x)
	else:print(0)
else:
	times = k - x // d
	num1 = x % d
	num2 = num1 - d
	if times % 2 == 0:
		print(np.abs(num1))
	else:
		print(np.abs(num2))
