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