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