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