#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int x,d, k;
   cin>>x>>k>>d;
   x=abs(x);
  if(x/d>=k){
    cout<<x-k*d<<endl;
  }
  else{    
    	k-=x/d;
    x-=(x/d)*d;
       if(k%2==0) cout<<abs(x)<<endl;
       else cout<<abs(x-d)<<endl;
  }
}