x, k, d = [int(i) for i in input().split()]
if x < 0:
  x = -x
l = min(k, x // d)
k -= l
x -= l * d
if k % 2 == 0:
  print(x)
else:
  print(d - x) int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i x, k, d = [int(i) for i in input().split()] x [int(i) for i in input().split()] k d if x < 0:
  x = -x x < 0 x 0 x = -x x -x x l = min(k, x // d) l min(k, x // d) min k x // d x d k -= l k l x -= l * d x l * d l d if k % 2 == 0:
  print(x)
else:
  print(d - x) k % 2 == 0 k % 2 k 2 0 print(x) print x print(d - x) print d - x d x x, k, d = [int(i) for i in input().split()] [int(i) for i in input().split()] x x = -x -x x x -= l * d l * d x k, d = [int(i) for i in input().split()] [int(i) for i in input().split()] k d = [int(i) for i in input().split()] [int(i) for i in input().split()] d l = min(k, x // d) min(k, x // d) l k -= l l k
x, k, d = [int(i) for i in input().split()]
if x < 0:
  x = -x
l = min(k, x // d)
k -= l
x -= l * d
if k % 2 == 0:
  print(x)
else:
  print(d - x)