Wires
Connoisseur of sound Vova decided to update his equipment. One of the ways to improve the sound is to use point-to-point wiring with heavy wires, and the wires must be as short as possible to diminish the resistance. It is clear how to connect two terminals, it is also easy to find an optimal wiring for three terminals. But what about four terminals?
There are four terminals on a circuit board. You should connect them (there must be a contact between each pair of terminals). It is permitted to add at most three auxiliary terminals and to connect terminals with wire pieces. The goal is to minimize the total length of the wires.
Input
First line contains the number of tests n (1 ≤ n ≤ 100). Each test consists of 4 lines that contain (x[i]
, y[i]
) coordinates of terminals (-200 ≤ x[i]
, y[i]
≤ 200, 1 ≤ i ≤ 4). Any two points out of four do not match. Tests are separated with an empty line.
Output
For each test, you should print a line containing the minimal possible length of the wires. The number must be given with at least four fractional digits.