Smuggler's Rift


Submit solution

Points: 1
Time limit: 1.5s
Python 6.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
C, C++, Java, Python

You are a bounty hunter searching for the hidden treasure of the legendary pharaoh, King Patrick III.

During his lifetime, Patrick considered many possible locations to bury his treasure. Each year, he recorded one such location as a simple polygon in the Western Desert.

After his death, his subjects buried the treasure at a location that lies inside the maximum number of these polygons. Now you want to find the area enclosing all points where Patrick's treasure could be.

Input

The first line contains a single integer n (1 \leq n \leq 17) — the number of locations Patrick considered for burying his treasure.

Then follow n blocks, each describing a polygon:

  • The first line of each block contains an integer m (1 \leq m \leq 50), the number of vertices of the polygon.

  • Then m lines follow, each containing two integers x and y (0 \leq x, y \leq 20), the coordinates of the i-th vertex of the polygon. The vertices are given in clockwise or counterclockwise order.

It is guaranteed that the sum of m over all polygons does not exceed 50.

Output

Output the area corresponding to the overlap between the maximum number of overlapping locations, in units squared. Your answer will be considered correct if it has an absolute error of no more than 5 \times 10^{-1}.

Note

Please use Pypy3 for your Python submissions.

Example

Input 1
3
3
1 10
18 19
15 6
4
2 3
1 19
17 18
17 10
3
5 2
10 16
17 4
Output 1
30.584960

The maximum number of overlapping polygons is 3. This occurs in an area of about 30.6 units squared, as shown below. Any answer between 30.1 and 31.1 units squared will be accepted.

Example 1

Input 2
3
5
0 0
20 0
20 20
10 10
3
0 2
10 2
5 20
3
10 5
20 5
15 20
Output 2
65.601740

The polygons given aren't nessecarily convex, and there can be more than one region with the maxiomum number of overlapping polygons.

Example 2

Input 3
2
4
0 0
0 1
1 1
1 0
4
0 1
0 2
1 2
1 1
Output 3
2.000000

Polygons that touch on the edges don't count as overlapping.

Example 3


Comments

There are no comments at the moment.