#icpc2014autumnd. [icpc2014autumn_d]Flowers

[icpc2014autumn_d]Flowers

MathJax.Hub.Config({ tex2jax: { inlineMath: [["","",""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 12px; line-height: 18px; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }

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 mathitth_i\\mathit{th}\_i. Note that mathitth_i\\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 Wtimesmathitvw_iW \\times \\mathit{vw}\_i for all ii (1leilen1 \\le i \\le n), and costs WtimesmathitpwW \\times \\mathit{pw} yen, where WW need not be an integer. mathitvw_i\\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 F_iF\_i kilograms of the ii-th fertilizer changes the vitality of the ii-th plant by F_itimesmathitvf_iF\_i \\times \\mathit{vf}\_i, and costs F_itimesmathitpf_iF\_i \\times \\mathit{pf}\_i yen, where F_iF\_i need not be an integer as well. Each fertilizer is specially made for the corresponding plant, therefore mathitvf_i\\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$, Wge0W \\ge 0, and F_ige0F\_i \\ge 0 for all ii (1leileN1 \\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 20mathrmMB20\\mathrm{MB}. Each dataset is formatted as follows.

NN
mathitpw\\mathit{pw}
mathitvw_1\\mathit{vw}\_1 mathitpf_1\\mathit{pf}\_1 mathitvf_1\\mathit{vf}\_1 mathitth_1\\mathit{th}\_1
:
:
mathitvw_N\\mathit{vw}\_N mathitpf_N\\mathit{pf}\_N mathitvf_N\\mathit{vf}\_N mathitth_N\\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 mathitpw\\mathit{pw}, cost of watering one liter. Each of the following NN lines describes a flower. The ii-th line contains four integers, mathitvw_i\\mathit{vw}\_i, mathitpf_i\\mathit{pf}\_i, mathitvf_i\\mathit{vf}\_i, and mathitth_i\\mathit{th}\_i, separated by a space.

You can assume that 1leNle1051 \\le N \\le 10^5, 1lemathitpwle1001 \\le \\mathit{pw} \\le 100, 100lemathitvw_ile100-100 \\le \\mathit{vw}\_i \\le 100, 1lemathitpf_ile1001 \\le \\mathit{pf}\_i \\le 100, 1lemathitvf_ile1001 \\le \\mathit{vf}\_i \\le 100, and 100lemathitth_ile100-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

```plain
43.5
36
13.5
0```

* * *

### Source Name

JAG Practice Contest for ACM-ICPC Asia Regional 2014

* * *