x, k, d = gets.split.map(&:to_i)
if x > 0 && x >= k * d
  puts x - k * d
elsif x < 0 && x <= k * d
  puts x + k * d
else
  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
end