x, k, d = gets.split.map(&:to_i)

def sgn(a)
  return 1 if a > 0
  return -1 if a < 0
  0
end

if x > 0
  y = x - k * d
else
  y = x + k * d
end

if sgn(x) == sgn(y)
  puts y
  exit
end

x_r = x % d
x_l = x_r - d
r_parity = ((x - x_r).abs / d) % 2
if k % 2 == r_parity
  puts x_r.abs
else
  puts x_l.abs
end