#include <bits/stdc++.h>
using namespace std;

typedef complex<double> P;
typedef vector<P> G;

const double eps = 1e-8;
const double inf = 1e8;

bool equals(double a, double b) {
  return abs(a-b) < eps;
}

bool equals(P a, P b) {
  return equals(a.real(), b.real()) && equals(a.imag(), b.imag());
}

struct C {
  P p;
  double r;
  C() {}
  C(P p, double r) : p(p), r(r) {}
};

double dot  (P a, P b) { return a.real()*b.real() + a.imag()*b.imag(); }
double cross(P a, P b) { return a.real()*b.imag() - a.imag()*b.real(); }

int ccw(P p0, P a, P b) {
  a -= p0;
  b -= p0;
  if(cross(a, b) > eps) return 1;
  if(cross(a, b) < -eps) return -1;
  if(dot(a, b) < -eps) return 2;
  if(norm(b)-norm(a) > eps) return -2;
  return 0;
}

P project(P s1, P s2, P p) {
  P base = s2 - s1;
  double t = dot(p - s1, base)/norm(base);
  return s1 + base*t;
}

double getAngleDist(P a, P b) { // 0 ~ 2PI
  double A = arg(a);
  double B = arg(b);
  double rad = B-A;
  rad = fmod(rad, M_PI*2.0);
  if(rad < 0.0) rad += M_PI*2.0;
  return rad;
}

double getDistanceLP(P s1, P s2, P p) {
  return abs(cross(s2 - s1, p - s1)/abs(s2 - s1));
}

double getDistanceSP(P s1, P s2, P p) {
  if(dot(s2 - s1, p - s1) < 0.0) return abs(p - s1);
  if(dot(s1 - s2, p - s2) < 0.0) return abs(p - s2);
  return getDistanceLP(s1, s2, p);
}

vector<P> getCrossPLC(P s1, P s2, C c) { // line, circle
  vector<P> v;
  P p = project(s1, s2, c.p);
  double dist = getDistanceLP(s1, s2, c.p);
  if(equals(dist, c.r)) {
    v.push_back(p);
  } else if(dist < c.r) {
    double h = abs(p - c.p);
    double d = sqrt(c.r*c.r - h*h);
    P base = s2 - s1;
    v.push_back(p - d*base/abs(base));
    v.push_back(p + d*base/abs(base));
  }
  return v;
}

int inCircle(P p, C c) {
  if(abs(c.p - p) - c.r <  -eps) return 2;
  if(abs(c.p - p) - c.r >  eps) return 0;
  return 1;
}

double getTriArea(P a, P b, P c) {
  return cross(b-a, c-a) / 2.0;
}

double getSectorArea(P a, P b, C c) {
  return getAngleDist(a-c.p, b-c.p) * c.r * c.r / 2.0;
}

double getBowArea(P a, P b, C c) { // a,b is a chord of c.
  return getSectorArea(a, b, c) - getTriArea(a, b, c.p);
}

double getArea(P a, P b, C c) {
  int d = 1;
  if(cross(a,b) < 0.0) {
    d = -1;
    swap(a, b);
  }
  if(cross(a, b) < eps) return 0;

  G t(3);
  t[0] = P(0, 0), t[1] = a, t[2] = b;

  if(inCircle(t[0], c) && inCircle(t[1], c) && inCircle(t[2], c)) {
    return d * getTriArea(t[0], t[1], t[2]);
  }

  if(getDistanceSP(t[0], t[1], c.p) - c.r > -eps &&
     getDistanceSP(t[1], t[2], c.p) - c.r > -eps &&
     getDistanceSP(t[2], t[0], c.p) - c.r > -eps) {
    if(cross(t[1] - t[0], c.p - t[0]) > -eps &&
       cross(t[2] - t[1], c.p - t[1]) > -eps &&
       cross(t[0] - t[2], c.p - t[2]) > -eps) {
      return d * (c.r * c.r * M_PI);
    } else {
      return 0;
    }
  }

  double S = c.r * c.r * M_PI;
  vector<P> cp(6);
  vector<int> exist(6);
  for(int i = 0; i < 3; ++i) {
    P p = t[i], q = t[(i+1)%3];
    if(getDistanceLP(p, q, c.p) - c.r > -eps) {
      if(cross(q - p, c.p - p) < 0) return 0;
      continue;
    }
    if(getDistanceSP(p, q, c.p) - c.r > -eps) continue;
    vector<P> v = getCrossPLC(t[i], t[(i+1)%3], c);
    if(v.size() == 2 && !equals(v[0], v[1])) {
      S -= getBowArea(v[0], v[1], c);
      for(int j = 0; j < v.size(); ++j) {
	int k = (i*2 + j*3) % 6;
	cp[k] = v[j];
	exist[k] = true;
      }
    }
  }
  for(int i = 0; i < 3; ++i) {
    int a = i*2, b = i*2+1;
    if(!exist[a] || !exist[b]) continue;
    if(inCircle(t[i], c) == 2 && !equals(cp[a], cp[b])) {
      S += getBowArea(cp[a], cp[b], c) + getTriArea(t[i], cp[a], cp[b]);
    }
  }
  return S * d;
}

double getArea(G g, C c) {
  int n = g.size();
  double res = 0;
  for(int i = 0; i < n; ++i) {
    res += getArea(g[i], g[(i+1)%n], c);
  }
  return res;
}

double getArea(G g) {
  int n = g.size();
  double res = 0;
  for(int i = 0; i < n; ++i) {
    res += cross(g[i], g[(i+1)%n]);
  }
  return res / 2.0;
}

int main() {
  int n;
  C c;
  cin >> n >> c.p.real() >> c.p.imag() >> c.r;
  double res = 0;
  for(int i = 0; i < n; ++i) {
    int p, score;
    cin >> p >> score;
    G g(p);
    for(int j = 0; j < p; ++j) {
      cin >> g[j].real() >> g[j].imag();
    }
    //printf("%.10f\n", abs(getArea(g, c)/(c.r*c.r*M_PI)));
    res += abs(getArea(g, c)) * score;
  }
  res /= c.r * c.r * M_PI;
  printf("%.10f\n", res);
  return 0;
}


Measured memory_bytes: 1320