x,k,d=map(int,input().split())
x=abs(x)
y=x//d
if k<=y:
  print(x-k*d)
else:
  if (k-y)%2==0:
    print(x-y*d)
  else:
    print(abs(d-x+y*d)) 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 y=x//d y x//d x d if k<=y:
  print(x-k*d)
else:
  if (k-y)%2==0:
    print(x-y*d)
  else:
    print(abs(d-x+y*d)) k<=y k y print(x-k*d) print x-k*d x k*d k d if (k-y)%2==0:
    print(x-y*d)
  else:
    print(abs(d-x+y*d)) (k-y)%2==0 (k-y)%2 k-y k y 2 0 print(x-y*d) print x-y*d x y*d y d print(abs(d-x+y*d)) print abs(d-x+y*d) abs d-x+y*d d-x d x y*d y d k,d=map(int,input().split()) map(int,input().split()) k x=abs(x) abs(x) x y=x//d x//d y d=map(int,input().split()) map(int,input().split()) d x,k,d=map(int,input().split()) map(int,input().split()) x
x,k,d=map(int,input().split())
x=abs(x)
y=x//d
if k<=y:
  print(x-k*d)
else:
  if (k-y)%2==0:
    print(x-y*d)
  else:
    print(abs(d-x+y*d))