x,k,d=map(int,input().split());xx=abs(x)
tmp=xx;tmp=(xx//d);cc=min(tmp,k)
xx-=d*cc;k-=cc;k&=1;xx-=d*k
print(abs(xx)) x,k,d=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d xx=abs(x) xx abs(x) abs x tmp=xx tmp xx tmp=(xx//d) tmp xx//d xx d cc=min(tmp,k) cc min(tmp,k) min tmp k xx-=d*cc xx d*cc d cc k-=cc k cc k&=1 k 1 xx-=d*k xx d*k d k print(abs(xx)) print abs(xx) abs xx d=map(int,input().split()) map(int,input().split()) d k&=1 1 k x,k,d=map(int,input().split()) map(int,input().split()) x tmp=xx xx tmp xx-=d*cc d*cc xx xx-=d*k d*k xx cc=min(tmp,k) min(tmp,k) cc tmp=(xx//d) xx//d tmp xx=abs(x) abs(x) xx k-=cc cc k k,d=map(int,input().split()) map(int,input().split()) k
x,k,d=map(int,input().split());xx=abs(x)
tmp=xx;tmp=(xx//d);cc=min(tmp,k)
xx-=d*cc;k-=cc;k&=1;xx-=d*k
print(abs(xx))