x,k,d=map(int,input().split())
x=abs(x)

if x>=k*d:
  print(x-k*d)
elif (k-x//d)%2==0:
  print(x-x//d*d)
else:
  print((x//d+1)*d-x) x,k,d=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d x=abs(x) x abs(x) abs x if x>=k*d:
  print(x-k*d)
elif (k-x//d)%2==0:
  print(x-x//d*d)
else:
  print((x//d+1)*d-x) x>=k*d x k*d k d print(x-k*d) print x-k*d x k*d k d elif (k-x//d)%2==0:
  print(x-x//d*d) (k-x//d)%2==0 (k-x//d)%2 k-x//d k x//d x d 2 0 print(x-x//d*d) print x-x//d*d x x//d*d x//d x d d print((x//d+1)*d-x) print (x//d+1)*d-x (x//d+1)*d x//d+1 x//d x d 1 d x d=map(int,input().split()) map(int,input().split()) d x=abs(x) abs(x) x k,d=map(int,input().split()) map(int,input().split()) k x,k,d=map(int,input().split()) map(int,input().split()) x
x,k,d=map(int,input().split())
x=abs(x)

if x>=k*d:
  print(x-k*d)
elif (k-x//d)%2==0:
  print(x-x//d*d)
else:
  print((x//d+1)*d-x)