x, k, d = gets.split.map(&:to_i)
if x.abs >= k * d
  puts x.abs - k * d
else
  if x < 0
    n = x.abs / d
    p = x + n * d
    puts (k - n).even? ? p.abs : (p + d).abs
  else
    n = x / d
    p = x - n * d
    puts (k - n).even? ? p.abs : (p - d).abs
  end
end