Superpolygons
On a plane, you are given N superpolygons (1 ≤ N ≤ 30) that do not intersect themselves or each other. Each superpolygon is described by the coordinates of its K_i vertices (3 ≤ K_i ≤ 30, 1 ≤ i ≤ N), listed in counterclockwise order. All coordinates are integers ranging from -32000 to 32000. Your task is to connect these superpolygons with segments such that:
Each segment connects exactly two superpolygons.
The total length of all segments is minimized.
Additionally, there must be a path (comprising segments and parts of the superpolygon boundaries) between any two superpolygons.
Input
The first line contains the integer N. Each of the following N lines contains the integer K_i followed by K_i pairs of integers, representing the coordinates of the vertices.
Output
The output should be a single line containing the total length of the segments, rounded to three decimal places.