import sys

# C - Walking Takahashi
X, K, D = map(int, input().split())

if D * K <= abs(X):
	print(abs(X) - D * K)
else:
	distance = abs(X) % D

	# 残りの移動回数
	count = K - (abs(X) // D)

	if count % 2 == 1:
		print(abs(D - distance))
	else:
		print(distance) import sys sys X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D if D * K <= abs(X):
	print(abs(X) - D * K)
else:
	distance = abs(X) % D

	# 残りの移動回数
	count = K - (abs(X) // D)

	if count % 2 == 1:
		print(abs(D - distance))
	else:
		print(distance) D * K <= abs(X) D * K D K abs(X) abs X print(abs(X) - D * K) print abs(X) - D * K abs(X) abs X D * K D K distance = abs(X) % D distance abs(X) % D abs(X) abs X D count = K - (abs(X) // D) count K - (abs(X) // D) K abs(X) // D abs(X) abs X D if count % 2 == 1:
		print(abs(D - distance))
	else:
		print(distance) count % 2 == 1 count % 2 count 2 1 print(abs(D - distance)) print abs(D - distance) abs D - distance D distance print(distance) print distance K, D = map(int, input().split()) map(int, input().split()) K X, K, D = map(int, input().split()) map(int, input().split()) X distance = abs(X) % D abs(X) % D distance count = K - (abs(X) // D) K - (abs(X) // D) count D = map(int, input().split()) map(int, input().split()) D
import sys

# C - Walking Takahashi
X, K, D = map(int, input().split())

if D * K <= abs(X):
	print(abs(X) - D * K)
else:
	distance = abs(X) % D

	# 残りの移動回数
	count = K - (abs(X) // D)

	if count % 2 == 1:
		print(abs(D - distance))
	else:
		print(distance)