# Here your code ! L, K = gets.chomp.split.map(&:to_i) l = L ans = 0 loop do break if l - 2*K <= 0 ans += K l -= 2*K end puts ans