#include <bits/stdc++.h>
using namespace std;
const int N = 5e4 + 8;
const long double eps = 1e-9;
const long double pi = acos(-1.0);
const long double inf = 1e6;
int cnt;
int segcnt = 0;
long double curang;
struct Point {
  long double x, y;
  long double corss(Point b) const { return x * b.y - b.x * y; }
  Point operator-(const Point& b) const { return (Point){x - b.x, y - b.y}; }
  long double len() { return sqrt(x * x + y * y); }
};
Point segcross(Point a, Point b, Point c, Point d, bool& ok) {
  long double u = (b - a).corss(c - a), v = (a - b).corss(d - b);
  if (fabs(u + v) < eps) {
    ok = 0;
    Point tem = {-1, -1};
    return tem;
  }
  ok = 1;
  return (Point){(c.x * v + d.x * u) / (u + v), (c.y * v + d.y * u) / (u + v)};
}
struct Seg {
  Point a, b;
  int id;
  bool operator<(const Seg& s) const {
    bool ok1, ok2;
    Point c = (Point){cos(curang), sin(curang)};
    Point o = (Point){0, 0};
    Point cr1 = segcross(a, b, o, c, ok1);
    Point cr2 = segcross(s.a, s.b, o, c, ok2);
    if (fabs(cr1.len() - cr2.len()) < eps) return id < s.id;
    return cr1.len() < cr2.len();
  }
};
vector<Point> pol[N];
long double ang[N];
vector<int> add[N], del[N];
Seg seg[N];
void add_seg(Point a, Point b) {
  long double anga = atan2l(a.y, a.x), angb = atan2l(b.y, b.x);
  if (fabs(anga - angb) < eps) return;
  if (anga > angb + eps) {
    swap(anga, angb);
    swap(a, b);
  }
  int pa = lower_bound(ang + 1, ang + 1 + cnt, anga) - ang;
  int pb = lower_bound(ang + 1, ang + 1 + cnt, angb) - ang;
  ++segcnt;
  seg[segcnt] = (Seg){a, b, segcnt};
  if (angb - anga > pi + eps) {
    if (fabs(anga + pi) > eps) {
      add[1].push_back(segcnt);
      del[pa].push_back(segcnt);
    }
    if (fabs(angb - pi) > eps) {
      add[pb].push_back(segcnt);
      del[cnt].push_back(segcnt);
    }
  } else {
    add[pa].push_back(segcnt);
    del[pb].push_back(segcnt);
  }
}
long double area(Point a, Point b, Point c, Point d) {
  long double res = 0;
  res += (b - a).corss(c - a);
  res += (c - a).corss(d - a);
  if (res < -eps) res = -res;
  return res * 0.5;
}
void solve() {
  set<Seg> st;
  long double ans = 0;
  curang = 0;
  for (int i = 1; i < cnt; ++i) {
    for (auto it : del[i]) st.erase(seg[it]);
    curang = (ang[i] + ang[i + 1]) / 2.0;
    for (auto it : add[i]) st.insert(seg[it]);
    if ((int)st.size() >= 2) {
      Seg s1, s2;
      auto it = st.begin();
      s1 = (*it);
      ++it;
      s2 = (*it);
      Point c1 = (Point){inf * cos(ang[i]), inf * sin(ang[i])};
      Point c2 = (Point){inf * cos(ang[i + 1]), inf * sin(ang[i + 1])};
      Point o = (Point){0, 0};
      bool ok1, ok2, ok3, ok4;
      Point a1 = segcross(o, c1, s1.a, s1.b, ok1);
      Point a2 = segcross(o, c1, s2.a, s2.b, ok2);
      Point a3 = segcross(o, c2, s2.a, s2.b, ok3);
      Point a4 = segcross(o, c2, s1.a, s1.b, ok4);
      ans += area(a1, a2, a3, a4);
    }
  }
  cout << ans << endl;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int m;
    cin >> m;
    Point tem;
    for (int j = 1; j <= m; ++j) {
      cin >> tem.x >> tem.y;
      pol[i].push_back(tem);
      ang[++cnt] = atan2l(tem.y, tem.x);
    }
    pol[i].push_back(pol[i][0]);
  }
  ang[++cnt] = -pi;
  ang[++cnt] = pi;
  sort(ang + 1, ang + 1 + cnt);
  cnt = unique(ang + 1, ang + 1 + cnt) - ang - 1;
  for (int i = 1; i <= n; ++i) {
    for (int k = 0; k < pol[i].size() - 1; ++k) {
      add_seg(pol[i][k], pol[i][k + 1]);
    }
  }
  solve();
  return 0;
}
