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

# k.times do
#   x = (x + d).abs <= (x - d).abs ? (x+d) : (x-d)
# end
#
# puts x.abs


if x / d < k
  if (k - (x / d)) % 2 == 0
    puts (x - (x / d) * d).abs if x >= 0
    puts (x + (x / d) * d).abs if x < 0
  else
    puts ((x - (x / d) * d).abs - d).abs if x >= 0
    puts ((x + (x / d) * d).abs + d).abs if x < 0
  end
else
  puts (x - k * d).abs
end
