position,moves,distance=[int(x) for x in input().split()]
position=abs(position)
if position>=distance*moves:
	print(abs(position-distance*moves))
else:
	variable=moves-position//distance
	if variable%2==0:
		print(abs((position-distance*(position//distance))))
	else:
		print(abs(position-distance*((position//distance) + 1))) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x position,moves,distance=[int(x) for x in input().split()] position [int(x) for x in input().split()] moves distance position=abs(position) position abs(position) abs position if position>=distance*moves:
	print(abs(position-distance*moves))
else:
	variable=moves-position//distance
	if variable%2==0:
		print(abs((position-distance*(position//distance))))
	else:
		print(abs(position-distance*((position//distance) + 1))) position>=distance*moves position distance*moves distance moves print(abs(position-distance*moves)) print abs(position-distance*moves) abs position-distance*moves position distance*moves distance moves variable=moves-position//distance variable moves-position//distance moves position//distance position distance if variable%2==0:
		print(abs((position-distance*(position//distance))))
	else:
		print(abs(position-distance*((position//distance) + 1))) variable%2==0 variable%2 variable 2 0 print(abs((position-distance*(position//distance)))) print abs((position-distance*(position//distance))) abs position-distance*(position//distance) position distance*(position//distance) distance position//distance position distance print(abs(position-distance*((position//distance) + 1))) print abs(position-distance*((position//distance) + 1)) abs position-distance*((position//distance) + 1) position distance*((position//distance) + 1) distance (position//distance) + 1 position//distance position distance 1 position=abs(position) abs(position) position distance=[int(x) for x in input().split()] [int(x) for x in input().split()] distance position,moves,distance=[int(x) for x in input().split()] [int(x) for x in input().split()] position variable=moves-position//distance moves-position//distance variable moves,distance=[int(x) for x in input().split()] [int(x) for x in input().split()] moves
position,moves,distance=[int(x) for x in input().split()]
position=abs(position)
if position>=distance*moves:
	print(abs(position-distance*moves))
else:
	variable=moves-position//distance
	if variable%2==0:
		print(abs((position-distance*(position//distance))))
	else:
		print(abs(position-distance*((position//distance) + 1)))