X,K,D = gets.strip.split.map(&:to_i)
x = X
num = []
if X-K*D>=0 then
  puts (X-K*D).abs
elsif X+K*D<=0 then
  puts (X+K*D).abs
else
  if X>=0 then
    s = (X-K*D).abs.to_f/(2*D)
    sa = s.floor
    sb = s.ceil
    puts [(X-K*D+2*D*sa).abs,(X-K*D+2*D*sb).abs].min
  else
    t = (X+K*D).abs.to_f/(2*D)
    ta = t.floor
    tb = t.ceil
    puts [(X+K*D-2*D*ta).abs,(X+K*D-2*D*tb).abs].min
  end
end