It's so hot this summer!
Vasya is walking along the street, which can be viewed as an infinite two-dimensional plane. He is currently at the point $$$S = (s_x, s_y)$$$, while an ice cream truck is stationed at the point $$$T = (t_x, t_y)$$$.
Despite his eagerness to get some ice cream, the intense sunshine makes the journey uncomfortable. Fortunately, there are $$$N$$$ shaded areas created by trees and buildings blocking the sun, providing some cooler spots. For the purpose of this problem, these shaded areas are considered as convex polygons.
Vasya aims to find a path to the ice cream truck that minimizes the distance traveled outside these shaded areas. Please determine the minimum length Vasya needs to walk without shade.
The first line is an integer $$$N$$$, denoting the number of shade areas. Then there will be $$$N$$$ sections, each describing a convex polygon.
The $$$i$$$-th section starts with an integer $$$k_i$$$, which is the number of vertices in the $$$i$$$-th shade. Each of the next $$$k_i$$$ lines will be two space-separated integers $$$x_{ij}, y_{ij}$$$, denoting the coordinate of the vertices of the convex polygon. In total, there will be $$$k_i + 1$$$ lines in the $$$i$$$-th section. The vertices will be given in counterclockwise order.
Finally, there will be two lines, each consists of two space-separated integers, $$$s_x, s_y$$$ and $$$t_x, t_y$$$, denoting the coordinate of the starting point and the goal.
Print the desired minimum length.
Your answer will be accepted if the absolute or relative error does not exceed $$$10^{-6}$$$. Formally, let your answer be $$$a$$$, and the jury's answer be $$$b$$$. Your answer is considered correct if $$$\frac{|a-b|}{\max(1,|b|)}\le 10^{-6}$$$.
3310 1020 1020 50330 5090 5070 60390 10100 1090 600 0100 0
34.14213562373095048677
34-80 0-70 -20-50 -25-60 20570 -4090 4070 3060 2050 -103-80 -20100 200 20-100 0100 0
39.40285000290663788153
The exact answer of sample 1 and sample 2 are $$$20 + 10 \sqrt{2}$$$ and $$$20 + \frac{80}{\sqrt{17}}$$$, respectively.
![]() | ![]() |
| Name |
|---|


