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