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;
template <typename T>
void chmin(T &x, const T &y) {
  if (x > y) x = y;
}
template <typename T>
void chmax(T &x, const T &y) {
  if (x < y) x = y;
}
int read() {
  char c;
  while ((c = getchar()) < '-')
    ;
  if (c == '-') {
    int x = (c = getchar()) - '0';
    while ((c = getchar()) >= '0') x = x * 10 + c - '0';
    return -x;
  }
  int x = c - '0';
  while ((c = getchar()) >= '0') x = x * 10 + c - '0';
  return x;
}
int sgn(const long double &x, const long double &eps = 1e-12) {
  return x < -eps ? -1 : x > eps;
}
long double sqr(const long double &x) { return x * x; }
struct Point {
  long double x, y;
};
long double dis2(const Point &a, const Point &b) {
  return sqr(a.x - b.x) + sqr(a.y - b.y);
}
Point operator-(const Point &a, const Point &b) {
  return {a.x - b.x, a.y - b.y};
}
Point operator+(const Point &a, const Point &b) {
  return {a.x + b.x, a.y + b.y};
}
long double operator^(const Point &a, const Point &b) {
  return a.x * b.x + a.y * b.y;
}
long double operator*(const Point &a, const Point &b) {
  return a.x * b.y - b.x * a.y;
}
Point operator*(const Point &a, const long double &b) {
  return {a.x * b, a.y * b};
}
Point O;
long double r, r2;
struct Polygon {
  vector<Point> p;
  int n;
  long double area;
  void init() {
    n = read();
    p.resize(n + 1);
    double px, py;
    for (int i = 0; i <= n - 1; ++i) {
      scanf("%lf%lf", &px, &py);
      p[i] = {px, py};
    }
    p[n] = p[0];
    area = 0;
    for (int i = 0; i <= n - 1; ++i) area += p[i] * p[i + 1];
    area = abs(area) / 2;
  }
  bool point_in_polygon() {
    int ret = 0;
    for (int i = 0; i <= n - 1; ++i) {
      Point u = p[i], v = p[i + 1];
      if (sgn(u.y - v.y) <= 0) swap(u, v);
      if (sgn(O.y - u.y) > 0 || sgn(O.y - v.y) <= 0) continue;
      ret += sgn((v - O) * (u - O)) > 0;
    }
    return ret & 1;
  }
  bool has_intersection() {
    for (int i = 0; i <= n - 1; ++i) {
      if (sgn(dis2(p[i], O) - r2) <= 0) return 1;
      if (sgn((O - p[i]) ^ (p[i + 1] - p[i])) > 0 &&
          sgn((O - p[i + 1]) ^ (p[i] - p[i + 1])) > 0)
        if (sgn(sqr((O - p[i]) * (p[i + 1] - p[i])) -
                r2 * dis2(p[i], p[i + 1])) <= 0)
          return 1;
    }
    return point_in_polygon();
  }
};
int main() {
  long double width, height;
  int n;
  cin >> width >> height >> n;
  vector<Polygon> poly(n);
  for (int i = 0; i <= n - 1; ++i) poly[i].init();
  int q;
  cin >> q;
  for (int tmp = 1; tmp <= q; ++tmp) {
    double Ox, Oy, Or;
    scanf("%lf%lf%lf", &Ox, &Oy, &Or);
    O = {Ox, Oy};
    r = Or;
    r2 = sqr(r);
    long double area = 0;
    vector<int> ans;
    for (int i = 0; i <= n - 1; ++i)
      if (poly[i].has_intersection()) {
        area += poly[i].area;
        ans.push_back(i);
      }
    printf("%f %d", (double)area, int(ans.size()));
    for (auto x : ans) printf(" %d", x);
    puts("");
  }
}