
input_str = gets
x, k, d = input_str.split.collect{|l| l.to_i.abs }

#puts "x=#{x}, k=#{k}, d=#{d}"
n = x / d
m = x % d
#puts "n=#{n}, m=#{m}"

if k < n then
  v = x - (k * d)
else
  v = x - (n * d)
  if (k - n).odd? then
    v = (v - d).abs
  end
end

puts v

