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;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
const int N = 2e6 + 10;
const double eps = 1e-8;
struct Point {
  double x, y;
};
inline int equal(double p, double q) { return fabs(p - q) < eps; }
inline bool operator<(const Point& a, const Point& b) {
  if (equal(a.x, b.x))
    return a.y < b.y;
  else
    return a.x < b.x;
}
inline bool operator==(const Point& a, const Point& b) {
  return equal(a.x, b.x) && equal(a.y, b.y);
}
inline double operator*(const Point& a, const Point& b) {
  return a.x * b.y - a.y * b.x;
}
inline double operator%(const Point& a, const Point& b) {
  return a.x * b.x + a.y * b.y;
}
inline Point operator-(const Point& a, const Point& b) {
  return (Point){a.x - b.x, a.y - b.y};
}
inline Point operator+(const Point& a, const Point& b) {
  return (Point){a.x + b.x, a.y + b.y};
}
inline Point operator*(double u, const Point& a) {
  return (Point){a.x * u, a.y * u};
}
inline double length(const Point& a) { return sqrt(a.x * a.x + a.y * a.y); }
inline vector<Point> convex_hull(vector<Point> u) {
  sort(u.begin(), u.end());
  u.erase(unique(u.begin(), u.end()), u.end());
  if (u.size() < 3) return u;
  vector<Point> c;
  for (size_t i = 0, opt = 1, m = 1; ~i; i += opt) {
    while (c.size() > m) {
      Point a = c.back() - c[c.size() - 2];
      Point b = c.back() - u[i];
      if (a * b < 0) break;
      c.pop_back();
    }
    c.push_back(u[i]);
    if (i + 1 == u.size()) {
      m = c.size();
      opt = -1;
    }
  }
  c.pop_back();
  return c;
}
inline bool on_xian(const Point& p, const Point& q, const Point& r) {
  if (q.x <= ((p.x) > (r.x) ? (p.x) : (r.x)) &&
      q.x >= ((p.x) < (r.x) ? (p.x) : (r.x)) &&
      q.y <= ((p.y) > (r.y) ? (p.y) : (r.y)) &&
      q.y >= ((p.y) < (r.y) ? (p.y) : (r.y)))
    return true;
  return false;
}
inline int zhi(const Point& p, const Point& q, const Point& r) {
  double val = (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
  if (fabs(val) < eps) return 0;
  return (val > 0) ? 1 : 2;
}
inline bool cha(const Point& p1, const Point& q1, const Point& p2,
                const Point& q2) {
  int o1 = zhi(p1, q1, p2), o2 = zhi(p1, q1, q2), o3 = zhi(p2, q2, p1),
      o4 = zhi(p2, q2, q1);
  if (o1 != o2 && o3 != o4) return true;
  if (o1 == 0 && on_xian(p1, p2, q1)) return true;
  if (o2 == 0 && on_xian(p1, q2, q1)) return true;
  if (o3 == 0 && on_xian(p2, p1, q2)) return true;
  if (o4 == 0 && on_xian(p2, q1, q2)) return true;
  return false;
}
double W, H, b[N];
vector<Point> a[N];
inline bool check_in(vector<Point>& polygon, Point p) {
  int n = polygon.size();
  if (n < 3) return false;
  Point extreme = {((W) > (H) ? (W) : (H)) * 2 + 5.17353162,
                   ((W) > (H) ? (W) : (H)) * 2 + 1.327354234};
  int count = 0, i = 0;
  do {
    int next = (i + 1) % n;
    if (cha(polygon[i], polygon[next], p, extreme))
      if (zhi(polygon[i], p, polygon[next]) == 0) {
        if (on_xian(polygon[i], p, polygon[next])) return true;
      } else
        count++;
    i = next;
  } while (i != 0);
  return count & 1;
}
inline double calc(const Point& x, const Point& a, const Point& b) {
  if ((x - a) % (b - a) <= 0) return 1e200;
  if ((x - b) % (a - b) <= 0) return 1e200;
  if (length(a - b) <= eps) return 1e200;
  return fabs((x - a) * (x - b)) / length(a - b);
}
inline bool check(vector<Point>& a, double x, double y, double r) {
  Point p = (Point){x, y};
  for (auto& q : a)
    if (length(p - q) <= r + eps) return true;
  for (int i = 0; i < a.size(); ++i)
    if (calc(p, a[i], a[(i + 1) % (a.size())]) <= r + eps) return true;
  if (check_in(a, p)) return true;
  return false;
}
int main() {
  scanf("%lf%lf", &W, &H);
  int n = read();
  for (int i = 0; i < n; ++i) {
    int x = read();
    a[i].clear();
    for (int j = 0; j < x; ++j) {
      double p, q;
      scanf("%lf%lf", &p, &q);
      a[i].push_back((Point){p, q});
    }
    double ans = a[i][x - 1] * a[i][0];
    for (int j = 1; j < x; ++j) ans += a[i][j - 1] * a[i][j];
    ans = fabs(ans) / 2.0;
    b[i] = ans;
  }
  int Q = read();
  vector<int> res;
  double x, y, r, ans = 0;
  while (Q--) {
    ans = 0.0;
    scanf("%lf%lf%lf", &x, &y, &r);
    res.clear();
    for (int i = 0; i < n; ++i)
      if (check(a[i], x, y, r)) {
        ans += b[i];
        res.push_back(i);
      }
    printf("%.15lf %d", ans, (int)(res.size()));
    for (auto& x : res) printf(" %d", x);
    puts("");
  }
  return 0;
}