x,k,d = gets.chomp.split(" ").map(&:to_i)
x = -x if x < 0
num = x / d
if k <= num
  puts x - k*d
else
  cnt = k - num
  dis = x - num*d
  cnt = cnt % 2
  if cnt == 1
    dis = dis - d
  end
  puts dis.abs
end
