X,K,D = gets.split.map(&:to_i)

D = -D if (X <= 0)

if (X - K*D > 0)
  puts (X - K*D).abs
  exit
else
  if (K - (X.to_f/D).ceil).even?
    puts (X - (X.to_f/D).ceil*K).abs
    exit
  else
    puts (X - (X.to_f/D).ceil*K + K).abs
    exit
  end
end
