#!/usr/bin/env ruby
inputs = gets.chomp.split(' ').map(&:to_i)

num = inputs[0]
min = inputs[0]
kaisu = inputs[1]

inputs[1].times do
  if inputs[0] > 0
    num = num - inputs[2]
  else
    num = num + inputs[2]
  end

  if num.abs <= min.abs
    return puts min.abs if num.abs == min.abs
    kaisu -= 1
    min = num
  else
    break
  end
end

return puts min.abs if kaisu % 2 == 0

tasu = min + inputs[2]
hiku = min + inputs[2]

if tasu.abs > hiku.abs
  puts tasu.abs
else
  puts hiku.abs
end
