Hermes' Colony

Time limit1sMemory limit128 MB

Problem

Hermes, the Greek god of speed, has built a two-dimensional colony named Massilia in space. The colony consists of one or more provinces and lies on a single plane in three-dimensional space (a linear equation). Each province contains 3 or 4 cities, and all of these cities lie on their convex hull.

The citizens of each province want to build a road network that connects the cities of their own province. The construction material cannot be found in the colony and must be shipped from Earth, and the amount of material needed is proportional to the total length of the roads. The citizens therefore want to build the road network of shortest possible total length that connects the different cities of a province. To make the network shorter, they may also create new junctions at points that are not cities.

For each province, find the minimum total length of a road network that connects all of its cities.

Input

The colony is described by the plane $ax + by + cz = d$. There are $N$ provinces in the colony. A city in a province is described by a point $(x, y, z)$ in three dimensions, and all coordinates $x$, $y$, and $z$ are between $-100.00$ and $+100.00$.

The first line contains the four real numbers $a$, $b$, $c$, and $d$. The second line contains the number of provinces $N$. The remaining input describes the provinces one by one.

The description of a province begins with a line containing the number of cities $M$ ($3 \le M \le 4$) in that province, followed by $M$ lines. Each of these lines contains the $x$, $y$, and $z$ coordinates of one city in the province.

Output

For each province, print one line in the following format:

Province # p : L

Here $p$ is the serial number of the province in the order it appears in the input ($1 \le p \le N$), and $L$ is the minimum length of the road network for that province. $L$ must be printed exact to two digits after the decimal point.