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>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const double rot = 234.0;
const double eps = (double)1.0 / 1000000000.0;
const int maxn = 1000005;
struct point {
  double x, y;
  point(double xx, double yy) { x = xx, y = yy; }
  double mag() { return sqrt((long double)x * x + (long double)y * y); }
};
struct line {
  double m, c;
  line(double mm, double cc) { m = mm, c = cc; }
};
double dist(point a, point b) {
  return sqrt(((long double)a.x - b.x) * ((long double)a.x - b.x) +
              ((long double)a.y - b.y) * ((long double)a.y - b.y));
}
line pointslope(point a, double m) { return line(m, -a.x * m + a.y); }
line pointpoint(point a, point b) {
  double m = (b.y - a.y) / (b.x - a.x);
  return pointslope(a, m);
}
point intersect(line a, line b) {
  double x = (b.c - a.c) / (a.m - b.m);
  double y = a.m * x + a.c;
  return {x, y};
}
double shoelace(vector<point> arr) {
  int n = arr.size();
  arr.push_back(arr.front());
  double res = 0;
  for (int i = 0; i < n; i++) {
    res += (arr[i].x * arr[i + 1].y - arr[i].y * arr[i + 1].x) / 2;
  }
  return abs(res);
}
point rotate(point a, double ang) {
  double r = a.mag(), aa = atan2(a.y, a.x);
  return {r * cos(aa + ang), r * sin(aa + ang)};
}
double width, height;
int n;
vector<pair<point, point>> arr[maxn];
double area[maxn];
int main() {
  scanf("%lf %lf %d", &width, &height, &n);
  for (int i = 0; i < n; i++) {
    int k;
    scanf("%d", &k);
    vector<point> tmp;
    for (int j = 0; j < k; j++) {
      double a, b;
      scanf("%lf %lf", &a, &b);
      tmp.push_back({a, b});
      tmp.back() = rotate(tmp.back(), rot);
    }
    area[i] = shoelace(tmp);
    tmp.push_back(tmp.front());
    for (int j = 0; j < k; j++) arr[i].push_back({tmp[j], tmp[j + 1]});
  }
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    double rx, ry, r;
    scanf("%lf %lf %lf", &rx, &ry, &r);
    point center = {rx, ry};
    center = rotate(center, rot);
    double tot = 0;
    vector<int> ids;
    bool flag = false;
    for (int id = 0; id < n; id++) {
      int cnt = 0;
      for (pair<point, point> pp : arr[id]) {
        point a = pp.first, b = pp.second;
        if (dist(a, center) <= r + eps || dist(b, center) <= r + eps) {
          tot += area[id];
          ids.push_back(id);
          flag = 1;
          break;
        }
        line cur = pointpoint(a, b);
        line perp = pointslope(center, -1.0 / cur.m);
        point bruh = intersect(cur, perp);
        if (dist(bruh, center) <= r + eps &&
            ((a.x <= bruh.x + eps && bruh.x <= b.x + eps) ||
             (b.x <= bruh.x + eps && bruh.x <= a.x + eps))) {
          tot += area[id];
          ids.push_back(id);
          flag = 1;
          break;
        }
        line para(0, center.y);
        point lol = intersect(cur, para);
        if (lol.x + eps > center.x) continue;
        if (((a.x <= lol.x + eps && lol.x <= b.x + eps) ||
             (b.x <= lol.x + eps && lol.x <= a.x + eps)))
          cnt++;
      }
      if (!flag && (cnt & 1)) {
        tot += area[id];
        ids.push_back(id);
      }
    }
    printf("%lf %d ", tot, (int)ids.size());
    for (int x : ids) printf("%d ", x);
    printf("\n");
  }
}