x, k, d = gets.chomp.split.map(&:to_i)
cnt = [k, x.abs / d].min
k -= cnt

if x <= 0
  x += cnt * d
  if k % 2 != 0 && k > 0
    x += d
  end
else
  x -= cnt * d
  if k % 2 != 0 && k > 0
    x -= d
  end
end
puts x.abs