X,K,D=input().split(' ')
x,k,d=abs(int(X)),int(K),int(D)

x_par=x%d
x_num=int((x-x_par)/d)

s=0
if x_num<=k:
  x_div=x-x_num*d
  k-=x_num
  if k%2==0:
    s=abs(x_div)
  else:
    s=x_div-d
else:
  s=x-d*k
print(abs(s)) X,K,D=input().split(' ') X input().split(' ') ().split () input split ' ' K D x,k,d=abs(int(X)),int(K),int(D) x abs(int(X)) abs int(X) int X k int(K) int K d int(D) int D x_par=x%d x_par x%d x d x_num=int((x-x_par)/d) x_num int((x-x_par)/d) int (x-x_par)/d x-x_par x x_par d s=0 s 0 if x_num<=k:
  x_div=x-x_num*d
  k-=x_num
  if k%2==0:
    s=abs(x_div)
  else:
    s=x_div-d
else:
  s=x-d*k x_num<=k x_num k x_div=x-x_num*d x_div x-x_num*d x x_num*d x_num d k-=x_num k x_num if k%2==0:
    s=abs(x_div)
  else:
    s=x_div-d k%2==0 k%2 k 2 0 s=abs(x_div) s abs(x_div) abs x_div s=x_div-d s x_div-d x_div d s=x-d*k s x-d*k x d*k d k print(abs(s)) print abs(s) abs s k-=x_num x_num k d=abs(int(X)),int(K),int(D) int(D) d s=x_div-d x_div-d s x_num=int((x-x_par)/d) int((x-x_par)/d) x_num D=input().split(' ') input().split(' ') D x_par=x%d x%d x_par s=x-d*k x-d*k s k,d=abs(int(X)),int(K),int(D) int(K) k s=abs(x_div) abs(x_div) s K,D=input().split(' ') input().split(' ') K x,k,d=abs(int(X)),int(K),int(D) abs(int(X)) x s=0 0 s X,K,D=input().split(' ') input().split(' ') X x_div=x-x_num*d x-x_num*d x_div
X,K,D=input().split(' ')
x,k,d=abs(int(X)),int(K),int(D)

x_par=x%d
x_num=int((x-x_par)/d)

s=0
if x_num<=k:
  x_div=x-x_num*d
  k-=x_num
  if k%2==0:
    s=abs(x_div)
  else:
    s=x_div-d
else:
  s=x-d*k
print(abs(s))