#include<bits/stdc++.h>
using namespace std;
const int N=1e5+7;

int main()
{
	long long x,k,d,t;
	scanf("%lld%lld%lld",&x,&k,&d);
	x=abs(x);
	t=x/d;
	if(t>=k)
		x-=k*d;
	else
	{
		x-=t*d;
		k-=t;
		if(k%2)x-=d;
	}
	printf("%lld\n",abs(x));
}
