def f(a, w, pw)
	a.map{|vw, pf, vf, th|
		r = [th - vw * w, 0].max
		r / vf * pf
	}.inject(:+) + pw * w
end

loop do
	n = gets.to_i	
	break if n == 0
	pw = gets.to_i
	flowers = (1..n).map{ gets.split.map &:to_f}
	
	l = 0
	r = 0
	a = flowers.select{|x| x[0] > 0}
	if a.size > 0
		r = [a.map(&:last).max, 0].max
		
		until r - l < 0.00001
			c1 = l * 2 / 3 + r / 3
			c2 = l / 3 + r * 2 / 3
			
			p1 = f(flowers, c1, pw)
			p2 = f(flowers, c2, pw)

			if p1 < p2
				r = c2
			else
				l = c1
			end
		end
	end
	p f(flowers, r, pw)
end