Problem: 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 width and height.

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

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) points in the counter-clockwise direction. 

Your task is to build an IT system which can handle queries of type (x, y, r) in which (x,y) represents a circle center, while r 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. 

Input

The first line contains the size of the building area as double values width, height, and an integer n — the number of properties in the database. 

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

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

Each of the next q lines contains double values x, y, r — the coordinates of an antenna circle center (x, y) and its radius r.

1 ≤ n * q ≤ 10^6

Output

For each of the q 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).

Example

Input


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


Output


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 10^{-4}.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1123456;
const long double eps = 1e-12;
int dcmp(long double x) {
  if (abs(x) < eps) return 0;
  return x > 0 ? 1 : -1;
}
struct Point {
  long double x, y;
  Point operator-(const Point &rhs) const { return {x - rhs.x, y - rhs.y}; }
  bool operator==(const Point &rhs) const {
    return dcmp(x - rhs.x) == 0 && dcmp(y - rhs.y) == 0;
  }
};
long double getDot(Point a, Point b) { return a.x * b.x + a.y * b.y; }
long double getCross(Point a, Point b) { return a.x * b.y - a.y * b.x; }
long double getLength(Point a) { return sqrt(getDot(a, a)); }
long double getDistanceToSegment(Point p, Point a, Point b) {
  Point A = p - a;
  if (a == b) return getLength(A);
  Point v1 = b - a, v2 = p - a, v3 = p - b;
  if (dcmp(getDot(v1, v2)) < 0) return getLength(v2);
  return dcmp(getDot(v1, v3)) > 0 ? getLength(v3)
                                  : abs(getCross(v1, v2) / getLength(v1));
}
long double getArea(const vector<Point> &p) {
  long double ret = 0;
  int n = p.size();
  for (int(i) = (0); (i) <= ((n - 1) - 1); (i)++) {
    Point a = p[i] - p[0], b = p[i + 1] - p[0];
    ret += getCross(a, b);
  }
  return abs(ret) / 2;
}
bool onSegment(Point o, Point a, Point b) {
  Point A = a - o, B = b - o;
  return dcmp(getCross(A, B)) == 0 && dcmp(getDot(A, B)) < 0;
}
int isPointInPolygon(Point o, vector<Point> &poly) {
  int wn = 0, n = poly.size();
  for (int(i) = (0); (i) <= ((n)-1); (i)++) {
    if (onSegment(o, poly[i], poly[(i + 1) % n])) return -1;
    Point v1 = poly[(i + 1) % n] - poly[i], v2 = o - poly[i];
    int k = dcmp(getCross(v1, v2));
    int d1 = dcmp(poly[i].y - o.y), d2 = dcmp(poly[(i + 1) % n].y - o.y);
    if (k > 0 && d1 <= 0 && d2 > 0) wn++;
    if (k < 0 && d2 <= 0 && d1 > 0) wn--;
  }
  return wn ? 1 : 0;
}
vector<Point> poly[maxn];
long double area[maxn];
int n, q;
double _w, _h;
int main() {
  scanf("%lf%lf%d", &_w, &_h, &n);
  for (int(i) = (0); (i) <= ((n)-1); (i)++) {
    int v;
    scanf("%d", &v);
    poly[i].resize(v);
    for (auto &[x, y] : poly[i]) {
      double _x, _y;
      scanf("%lf%lf", &_x, &_y);
      x = _x, y = _y;
    }
    area[i] = getArea(poly[i]);
  }
  scanf("%d", &q);
  while (q--) {
    Point o;
    long double r;
    double _x, _y, _r;
    scanf("%lf%lf%lf", &_x, &_y, &_r);
    o.x = _x, o.y = _y, r = _r;
    vector<int> ans;
    long double a = 0;
    for (int(i) = (0); (i) <= ((n)-1); (i)++) {
      bool sel = false;
      for (int(j) = (0); (j) <= ((int(poly[i].size())) - 1); (j)++) {
        if (dcmp(getDistanceToSegment(o, poly[i][j],
                                      poly[i][(j + 1) % poly[i].size()]) -
                 r) <= 0) {
          sel = true;
          break;
        }
      }
      if (!sel && isPointInPolygon(o, poly[i])) sel = true;
      if (sel) {
        ans.emplace_back(i);
        a += area[i];
      }
    }
    printf("%.10lf %d", double(a), int(ans.size()));
    for (auto x : ans) printf(" %d", x);
    putchar('\n');
  }
}