x, k, d = gets.split(" ").map(&:to_i)
if x.abs >= k * d
  puts x.abs - (k * d)
  exit
end
xx=0
yy=1
flag=false
before_0 = x / d 
if (k - before_0) % 2 == 0
  puts (x - (before_0 * d)).abs
  flag=true
  yy+=1
else (k - before_0) % 2 != 0
  puts  (x - (before_0 * d) - d).abs
  flag=false
  xx+=1
end 