Rocket

아직 제출이 없습니다시간 제한1초메모리 제한256 MB

문제

The secret design bureau of the X Institution, or just the Bureau, is working on an ambitious project: they are building a rocket which must reach the Sun and land on its suface. The rocket design is very complicated, however, the blueprints are ready, and a set of the necessary structural parts has been approved. For the ii-th detail, the Bureau is considering K_iK\_i appropriate basic materials, each characterized by two valuesm_ijm\_{ij} and c_ijc\_{ij}. m_ijm\_{ij} is the mass of the detail made completely of that particular basic material, and c_ijc\_{ij} is its cost in this case.

The material for the ii-th detail can be one of the K_iK\_i basic materials or an alloy of two basic materials. In case of an alloy of two basic materials with the masses m_1m\_1, m_2m\_2 and the costs c_1c\_1, c_2c\_2 in the proportion of α(0;1)\alpha \in (0; 1), the resulting part has the mass αm_1+(1α)m_2\alpha m\_1 + (1 - \alpha) m\_2 and the cost αc_1+(1α)c_2\alpha c\_1 + (1 - \alpha) c\_2. The engineers are not sure about the durability of three-material alloys. Perhaps we shouldn't bother with them, either.

Your task is to decide for each of the NN parts, which material it should be made of in order to minimize its cost. The rocket must be able to take off, so the total mass of all parts must not be greater than MM.

입력

The first line of the input file contains two positive integers NN and MM  --- the number of parts necessary for building the rocket and the maximal total mass of all parts (1M1091 \leq M \leq 10^9).

Next come NN blocks of lines. The ii-th block provides the description of the ii-th part. The description of the ii-th block begins from a line containing a positive integer K_iK\_i. It is followed by K_iK\_i lines, with the jj-th line containing two integers m_ijm\_{ij} and c_ijc\_{ij}  --- the mass and cost of the ii-th part made entirely of the jj-th recommended basic material (1m_ij,c_ij1091 \leq m\_{ij}, c\_{ij} \leq 10^9).

It is guaranteed that _i=1NK_i105\sum\limits\_{i=1}^N K\_i \leq 10^5. It is also guaranteed that there is a solution.

출력

The first line of the output file must contain the minimal possible cost of the rocket as a real number. The ii-th of the following lines must contain the description of the optimal material for the ii-th part (1iN1 \le i \le N).

The description of the material for the ii-th part must have the following structure.

If the ii-th part must be made of a basic material, the description line has the format "11 AA", where the integer AA is the number of the basic material (1AK_i1 \leq A \leq K\_i).

If the ii-th part must be made of an alloy of two basic materials, the description line must have the format "22 AA BB XX YY", where the integers AA and BB are the numbers of basic materials (1A,BK_i1 \leq A, B \leq K\_i), and the integers XX и YY are the numenator and denominator of the alloy proportion (0<X<Y1090 < X < Y \leq 10^{9}, α=XY\alpha = \frac{X}{Y}).

It is required for proportions of all alloys in your answer to have the same denominator YY. It is guaranteed that solution satisfying this condition exists. The relative or absolute error of your answer (the minimal cost of the rocket) must be less than or equal 101210^{-12}.