#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long double PI = 4 * atanl(1);
const long double eps = 1e-11;
bool eq(long double x, long double y) { return fabsl(x - y) < eps; }
bool ls(long double x, long double y) { return x < y && !eq(x, y); }
bool lseq(long double x, long double y) { return x < y || eq(x, y); }
struct Point {
  long double x, y;
  Point() : x(), y() {}
  Point(long double _x, long double _y) : x(_x), y(_y) {}
  void scan() {
    double _x, _y;
    scanf("%lf%lf", &_x, &_y);
    x = _x;
    y = _y;
  }
  Point operator+(const Point &a) const { return Point(x + a.x, y + a.y); }
  Point operator-(const Point &a) const { return Point(x - a.x, y - a.y); }
  Point operator*(const long double &k) const { return Point(x * k, y * k); }
  Point operator/(const long double &k) const { return Point(x / k, y / k); }
  long double operator%(const Point &a) const { return x * a.x + y * a.y; }
  long double operator*(const Point &a) const { return x * a.y - y * a.x; }
  long double sqrLen() const { return *this % *this; }
  long double len() const { return sqrtl(sqrLen()); }
  Point ort() const { return Point(-y, x); }
  Point rot(const long double &ca, const long double &sa) const {
    return *this * ca + ort() * sa;
  }
  Point rot(const long double &ang) const { return rot(cosl(ang), sinl(ang)); }
  void eprint() { 42; }
};
bool onSegm(Point A, Point B, Point C) { return lseq((A - B) % (C - B), 0); }
bool intersectLines(Point A, Point a, Point B, Point b, Point &I) {
  if (eq(a * b, 0)) return false;
  long double y = ((A - B) * a) / (b * a);
  I = B + b * y;
  return true;
}
long double PHI;
struct Segm {
  Point P, Q;
  Segm() : P(), Q() {}
  Segm(Point _P, Point _Q) {
    P = _P;
    Q = _Q;
    if (eq(P * Q, 0)) throw;
    if (P * Q < 0) swap(P, Q);
  }
  long double getPointInDir(const long double &phi) const {
    Point I;
    Point dd = Point(1, 0).rot(phi);
    if (!intersectLines(Point(), Point(1, 0).rot(phi), P, Q - P, I)) return -1;
    return I.sqrLen();
  }
  bool operator<(const Segm &S) const {
    return ls(getPointInDir(PHI), S.getPointInDir(PHI));
  }
  void eprint() {
    P.eprint();
    Q.eprint();
    42;
  }
};
const int N = 100100;
Point a[N];
Point b[N][2];
long double c[N];
vector<Segm> ev[N][2];
int n, m;
set<Segm> setik;
void eprintSet() {
  42;
  for (Segm S : setik) S.eprint();
  42;
}
void read() {
  int q;
  scanf("%d", &q);
  while (q--) {
    int k;
    scanf("%d", &k);
    for (int i = 0; i < k; i++) a[i].scan();
    a[k] = a[0];
    for (int i = 0; i < k; i++) {
      b[n][0] = a[i];
      b[n][1] = a[i + 1];
      n++;
    }
    for (int i = 0; i < k; i++) c[m++] = atan2l(a[i].y, a[i].x);
  }
  sort(c, c + m);
  int mm = 0;
  for (int i = 0; i < m; i++) {
    if (mm == 0 || !eq(c[i], c[mm - 1])) c[mm++] = c[i];
  }
  m = mm;
  c[m] = c[0] + 2 * PI;
  PHI = (c[m - 1] + c[m]) / 2;
  for (int i = 0; i < n; i++) {
    Point P = b[i][0], Q = b[i][1];
    if (eq(P * Q, 0)) continue;
    Segm S = Segm(P, Q);
    long double ang1 = atan2l(S.P.y, S.P.x), ang2 = atan2l(S.Q.y, S.Q.x);
    int pos1 = lower_bound(c, c + m, ang1 - eps) - c;
    int pos2 = lower_bound(c, c + m, ang2 - eps) - c;
    ev[pos1][0].push_back(S);
    ev[pos2][1].push_back(S);
    if (pos1 > pos2) setik.insert(S);
  }
}
long double getArea2(Segm S, long double phi1, long double phi2) {
  long double A = S.getPointInDir(phi1), B = S.getPointInDir(phi2);
  if (A < -0.5 || B < -0.5) throw;
  return sinl(phi2 - phi1) * sqrtl(A * B) / 2;
}
long double getArea(long double phi1, long double phi2) {
  if (setik.empty()) return 0;
  if ((int)setik.size() == 1) return 0;
  Segm S1, S2;
  auto it = setik.begin();
  S1 = *it;
  it++;
  S2 = *it;
  return getArea2(S2, phi1, phi2) - getArea2(S1, phi1, phi2);
}
int main() {
  read();
  long double ans = 0;
  for (int i = 0; i < m; i++) {
    for (Segm S : ev[i][1]) {
      setik.erase(S);
    }
    PHI = (c[i] + c[i + 1]) / 2;
    for (Segm S : ev[i][0]) {
      setik.insert(S);
    }
    ans += getArea(c[i], c[i + 1]);
  }
  printf("%.13lf\n", (double)ans);
  return 0;
}
