#P1423E. 5G Antenna Towers

5G Antenna Towers

No submission language available for this problem.

Description

After making a strategic plan with carriers for expansion of mobile network throughout the whole country, the government decided to cover rural areas with the last generation of 5G network.

Since 5G antenna towers will be built in the area of mainly private properties, the government needs an easy way to find information about landowners for each property partially or fully contained in the planned building area.

The planned building area is represented as a rectangle with sides widthwidth and heightheight.

Every 5G antenna tower occupies a circle with a center in (x,y)(x,y) and radius rr.

There is a database of Geodetic Institute containing information about each property. Each property is defined with its identification number and polygon represented as an array of (x,y)(x,y) points in the counter-clockwise direction.

Your task is to build an IT system which can handle queries of type (x,y,r)(x, y, r) in which (x,y)(x,y) represents a circle center, while rr represents its radius. The IT system should return the total area of properties that need to be acquired for the building of a tower so that the government can estimate the price. Furthermore, the system should return a list of identification numbers of these properties (so that the owners can be contacted for land acquisition).

A property needs to be acquired if the circle of the antenna tower is intersecting or touching it.

The first line contains the size of the building area as double values widthwidth, heightheight, and an integer nn — the number of properties in the database.

Each of the next nn lines contains the description of a single property in the form of an integer number vv (3v403 \le v \le 40) — the number of points that define a property, as well as 2v2*v double numbers — the coordinates (x,y)(x,y) of each property point. Line ii (0in10 \le i \le n-1) contains the information for property with id ii.

The next line contains an integer qq — the number of queries.

Each of the next qq lines contains double values xx, yy, rr — the coordinates of an antenna circle center (x,y)(x, y) and its radius rr.

1nq1061 \le n * q \le 10^6

For each of the qq queries, your program should output a line containing the total area of all the properties that need to be acquired, an integer representing the number of such properties, as well as the list of ids of these properties (separated by blank characters, arbitrary order).

Input

The first line contains the size of the building area as double values widthwidth, heightheight, and an integer nn — the number of properties in the database.

Each of the next nn lines contains the description of a single property in the form of an integer number vv (3v403 \le v \le 40) — the number of points that define a property, as well as 2v2*v double numbers — the coordinates (x,y)(x,y) of each property point. Line ii (0in10 \le i \le n-1) contains the information for property with id ii.

The next line contains an integer qq — the number of queries.

Each of the next qq lines contains double values xx, yy, rr — the coordinates of an antenna circle center (x,y)(x, y) and its radius rr.

1nq1061 \le n * q \le 10^6

Output

For each of the qq queries, your program should output a line containing the total area of all the properties that need to be acquired, an integer representing the number of such properties, as well as the list of ids of these properties (separated by blank characters, arbitrary order).

Samples

Sample Input 1

10 10 3
4 2 2 3 2 3 3 2 3
3 3.5 2 4.5 2 4.5 3
4 7 8 7.5 8.5 8 8 7.5 9
5
2 3.5 0.5
3.3 2 0.4
5 2.5 0.5
7.5 8.5 0.5
3 7 0.5

Sample Output 1

1.000000 1 0 
1.500000 2 0 1 
0.500000 1 1 
0.250000 1 2 
0.000000 0

Note

You can assume that the land not covered with properties (polygons) is under the government's ownership and therefore doesn't need to be acquired. Properties do not intersect with each other.

Precision being used for solution checking is 10410^{-4}.