Transport Pluses

시간 제한2초메모리 제한2048 MB

문제

Cambeet lives on a plane. He wants to travel from his home located at point $(x_{\mathrm{h}}, y_{\mathrm{h}})$ to the exhibition located at point $(x_{\mathrm{e}}, y_{\mathrm{e}})$. There are two ways to travel on the plane, and each consumes energy.

First, one can move along a segment between two points. The energy required for such travel is equal to the length of the segment: moving from point $(x_{\mathrm{a}}, y_{\mathrm{a}})$ to points $(x_{\mathrm{b}}, y_{\mathrm{b}})$ consumes $\displaystyle \sqrt{\left|x_{\mathrm{b}} - x_{\mathrm{a}}\right|^2 + \left|y_{\mathrm{b}} - y_{\mathrm{a}}\right|^2}$ units of energy.

Second, there are $n$ transport pluses on the plane, numbered by integers from $1$ to $n$. Plus $i$ is centered at point $(x_i, y_i)$ and connects all points with $x = x_i$ or $y = y_i$: one can instantly travel from any such point to any other such point, they just have to input the coordinates in a mobile app. Each use of any plus consumes $t$ units of energy.

Cambeet can use any ways of travel in any order. Help him find a path that will require the minimum total amount of energy.

입력

The first line contains two integers $n$ and $t$: the number of transport pluses and the energy consumed by every use of a plus ($0 \le n, t \le 100$). The second line contains two integers $x_{\mathrm{h}}$ and $y_{\mathrm{h}}$: the coordinates of Cambeet's home ($0 \le x_{\mathrm{h}}, y_{\mathrm{h}} \le 100$). The third line contains two integers $x_{\mathrm{e}}$ and $y_{\mathrm{e}}$: the coordinates of the exhibition ($0 \le x_{\mathrm{e}}, y_{\mathrm{e}} \le 100$). Each of the next $n$ lines contains two integers $x_i$ and $y_i$: the coordinates of the center of $i$-th plus ($0 \le x_i, y_i \le 100$).

All input data are integers. However, Cambeet can freely travel to points with any real coordinates.

출력

On the first line, print a real number: the total consumed energy. On the second line, print an integer $k$: the number of moves in the path ($0 \le k \le 10\,000$). On each of the next $k$ lines, print three integers $p_j$, $x_j$ and $y_j$: the number of the plus being used and the coordinates of the next target. The value of $p_j$ can be zero, which means traveling along a segment, or an integer from $1$ to $n$, which means using a plus with such number. The coordinates can be any real numbers from $0$ to $100$. When using a plus, this plus must connect the current position and the next target. The path must end at $(x_{\mathrm{e}}, y_{\mathrm{e}})$.

You can print any path that requires the minimum total amount of energy. The answer will be considered correct if the total consumed energy differs from the minimum possible by at most $10^{-3}$.