#D8835. Flowers

    ID: 7342 Type: Default 8000ms 536MiB

Flowers

Flowers

Problem Statement

We have planted NN flower seeds, all of which come into different flowers. We want to make all the flowers come out together.

Each plant has a value called vitality, which is initially zero. Watering and spreading fertilizers cause changes on it, and the ii-th plant will come into flower if its vitality is equal to or greater than thi\mathit{th}_i. Note that thi\mathit{th}_i may be negative because some flowers require no additional nutrition.

Watering effects on all the plants. Watering the plants with WW liters of water changes the vitality of the ii-th plant by W×vwiW \times \mathit{vw}_i for all ii (1in1 \le i \le n), and costs W×pwW \times \mathit{pw} yen, where WW need not be an integer. vwi\mathit{vw}_i may be negative because some flowers hate water.

We have NN kinds of fertilizers, and the ii-th fertilizer effects only on the ii-th plant. Spreading FiF_i kilograms of the ii-th fertilizer changes the vitality of the ii-th plant by Fi×vfiF_i \times \mathit{vf}_i, and costs Fi×pfiF_i \times \mathit{pf}_i yen, where FiF_i need not be an integer as well. Each fertilizer is specially made for the corresponding plant, therefore vfi\mathit{vf}_i is guaranteed to be positive.

Of course, we also want to minimize the cost. Formally, our purpose is described as "to minimize $W \times \mathit{pw} + \sum_{i=1}^{N}(F_i \times \mathit{pf}_i)$ under $W \times \mathit{vw}_i + F_i \times \mathit{vf}_i \ge \mathit{th}_i$, W0W \ge 0, and Fi0F_i \ge 0 for all ii (1iN1 \le i \le N)". Your task is to calculate the minimum cost.

Input

The input consists of multiple datasets. The number of datasets does not exceed 100100, and the data size of the input does not exceed 20MB20\mathrm{MB}. Each dataset is formatted as follows.

NN pw\mathit{pw} vw1\mathit{vw}_1 pf1\mathit{pf}_1 vf1\mathit{vf}_1 th1\mathit{th}_1 : : vwN\mathit{vw}_N pfN\mathit{pf}_N vfN\mathit{vf}_N thN\mathit{th}_N

The first line of a dataset contains a single integer NN, number of flower seeds. The second line of a dataset contains a single integer pw\mathit{pw}, cost of watering one liter. Each of the following NN lines describes a flower. The ii-th line contains four integers, vwi\mathit{vw}_i, pfi\mathit{pf}_i, vfi\mathit{vf}_i, and thi\mathit{th}_i, separated by a space.

You can assume that 1N1051 \le N \le 10^5, 1pw1001 \le \mathit{pw} \le 100, 100vwi100-100 \le \mathit{vw}_i \le 100, 1pfi1001 \le \mathit{pf}_i \le 100, 1vfi1001 \le \mathit{vf}_i \le 100, and 100thi100-100 \le \mathit{th}_i \le 100.

The end of the input is indicated by a line containing a zero.

Output

For each dataset, output a line containing the minimum cost to make all the flowers come out. The output must have an absolute or relative error at most 10410^{-4}.

Sample Input

3 10 4 3 4 10 5 4 5 20 6 5 6 30 3 7 -4 3 4 -10 5 4 5 20 6 5 6 30 3 1 -4 3 4 -10 -5 4 5 -20 6 5 6 30 3 10 -4 3 4 -10 -5 4 5 -20 -6 5 6 -30 0

Output for the Sample Input

43.5 36 13.5 0

Example

Input

3 10 4 3 4 10 5 4 5 20 6 5 6 30 3 7 -4 3 4 -10 5 4 5 20 6 5 6 30 3 1 -4 3 4 -10 -5 4 5 -20 6 5 6 30 3 10 -4 3 4 -10 -5 4 5 -20 -6 5 6 -30 0

Output

43.5 36 13.5 0

inputFormat

Input

The input consists of multiple datasets. The number of datasets does not exceed 100100, and the data size of the input does not exceed 20MB20\mathrm{MB}. Each dataset is formatted as follows.

NN pw\mathit{pw} vw1\mathit{vw}_1 pf1\mathit{pf}_1 vf1\mathit{vf}_1 th1\mathit{th}_1 : : vwN\mathit{vw}_N pfN\mathit{pf}_N vfN\mathit{vf}_N thN\mathit{th}_N

The first line of a dataset contains a single integer NN, number of flower seeds. The second line of a dataset contains a single integer pw\mathit{pw}, cost of watering one liter. Each of the following NN lines describes a flower. The ii-th line contains four integers, vwi\mathit{vw}_i, pfi\mathit{pf}_i, vfi\mathit{vf}_i, and thi\mathit{th}_i, separated by a space.

You can assume that 1N1051 \le N \le 10^5, 1pw1001 \le \mathit{pw} \le 100, 100vwi100-100 \le \mathit{vw}_i \le 100, 1pfi1001 \le \mathit{pf}_i \le 100, 1vfi1001 \le \mathit{vf}_i \le 100, and 100thi100-100 \le \mathit{th}_i \le 100.

The end of the input is indicated by a line containing a zero.

outputFormat

Output

For each dataset, output a line containing the minimum cost to make all the flowers come out. The output must have an absolute or relative error at most 10410^{-4}.

Sample Input

3 10 4 3 4 10 5 4 5 20 6 5 6 30 3 7 -4 3 4 -10 5 4 5 20 6 5 6 30 3 1 -4 3 4 -10 -5 4 5 -20 6 5 6 30 3 10 -4 3 4 -10 -5 4 5 -20 -6 5 6 -30 0

Output for the Sample Input

43.5 36 13.5 0

Example

Input

3 10 4 3 4 10 5 4 5 20 6 5 6 30 3 7 -4 3 4 -10 5 4 5 20 6 5 6 30 3 1 -4 3 4 -10 -5 4 5 -20 6 5 6 30 3 10 -4 3 4 -10 -5 4 5 -20 -6 5 6 -30 0

Output

43.5 36 13.5 0

样例

3
10
4 3 4 10
5 4 5 20
6 5 6 30
3
7
-4 3 4 -10
5 4 5 20
6 5 6 30
3
1
-4 3 4 -10
-5 4 5 -20
6 5 6 30
3
10
-4 3 4 -10
-5 4 5 -20
-6 5 6 -30
0
43.5

36 13.5 0

</p>