#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    ll n,x,d,k,ans=0;
    cin>>x>>k>>d;
    x=abs(x);
    if(k <= x/d )cout<< x - k*d;

    else {
        k-=(x/d);
        x%=d;  

        if(k%2)cout<<abs(d-x);
        else cout<<x; 
    }
}