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