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

divided = X / D

if divided > K then
    puts X.abs - D.abs * K
else
    x = X.abs - D.abs * divided
    k = K - divided
    #puts "x = #{x}, k = #{k}"
    if k.even? then
        puts x
    else
        puts (x - D.abs).abs
    end
end
