def f(a, w, pw)
	s = 0
	a.map{|vw, ef, th|
		if  (r = th - vw * w) > 0
			s += r * ef
		end
	}
	s + pw * w
end

loop.with_index do |_, itr|
	n = gets.to_i	
	break if n == 0
	pw = gets.to_i
	flowers = (1..n).map { vw, pf, vf, th = gets.split.map(&:to_f); [vw, pf / vf, th]}
	
	a = flowers.select{|x| x[0] > 0}
	if a.size > 0
		phi = (1 + Math.sqrt(5)) / 2
		x1 = 0.0
		x4 = [a.map(&:last).max, 0].max.to_f
		a = phi / (1 + phi)
		x2 = a * x1 + (1 - a) * x4
		x3 = (1 - a) * x1 + a * x4

		e = 0.000001

		loop do
			p1 = f(flowers, x2, pw)
			p2 = f(flowers, x3, pw)

			if p1 < p2
				break if (p2 - p1) / p1 < e
				x1, x2, x3, x4 = x1, a * x1 + (1 - a) * x3, x2, x3
			elsif p1 > p2
				break if (p1 - p2) / p2 < e
				x1, x2, x3, x4 = x2, x3, (1 - a) * x2 + a * x4, x4
			else
				break
			end
		end

		p f(flowers, x2, pw)
	else
		p f(flowers, 0, pw)
	end
end