#include <bits/stdc++.h>
using namespace std;
const int N = 510,eps = 1e-8;
#define x first
#define y second
typedef pair<double,double> PDD;
struct line{
PDD st,ed;
}Line[N];
int q[N];
PDD pg[N],ans[N];
int n,m,cnt;
int sign(double x){
if(fabs(x)<eps) return 0;
if(x<0) return -1;
return 1;
}
int dcmp(double x,double y){
if(fabs(x-y)<eps) return 0;
if(x-y<0) return -1;
return 1;
}
double get_angle(line a){
return atan2(a.ed.y-a.st.y,a.ed.x-a.st.x);
}
PDD operator-(PDD a,PDD b){
return {a.x-b.x,a.y-b.y};
}
double dot(PDD a,PDD b){
return a.x*b.x+a.y-b.y;
}
double cross(PDD a,PDD b){
return a.x*b.y-a.y*b.x;
}
double area(PDD a,PDD b,PDD c){
return cross(b-a,c-a);
}
bool cmp(line&a,line&b){
double angle1 = get_angle(a),angle2 = get_angle(b);
if(!dcmp(angle1,angle2)) return cross(a.ed-a.st,b.ed-a.st)<0;
return angle1<angle2;
}
PDD get_insection(PDD p,PDD v,PDD q,PDD w){
auto u = p-q;
double t = cross(w,u)/cross(v,w);
return {p.x+v.x*t,p.y+v.y*t};
}
PDD get_line_insection(line a,line b){
return get_insection(a.st,a.ed-a.st,b.st,b.ed-b.st);
}
bool onright(line&a,line&b,line&c){
auto o = get_insection(b.st,b.ed-b.st,c.st,c.ed-c.st);
return sign(area(a.st,a.ed,o))<=0;
}
double half_plane_insection(){
sort(Line,Line+cnt,cmp);
int hh =0,tt =-1;
for(int i =0;i<cnt;i++){
if(i&&!dcmp(get_angle(Line[i]),get_angle(Line[i-1]))) continue;
while(hh+1<=tt&&onright(Line[i],Line[q[tt-1]],Line[q[tt]])) tt--;
while(hh+1<=tt&&onright(Line[i],Line[q[hh]],Line[q[hh+1]])) hh++;
q[++tt] = i;
}
while(hh+1<=tt&&onright(Line[q[hh]],Line[q[tt]],Line[q[tt-1]])) tt--;
while(hh+1<=tt&&onright(Line[q[tt]],Line[q[hh]],Line[q[hh+1]])) hh++;
q[++tt] = q[hh];
int k = 0;
for(int i= hh;i+1<=tt;i++){
ans[k++] = get_line_insection(Line[q[i]],Line[q[i+1]]);
}
double res = 0;
for(int i = 0;i+1<k;i++){
res+=area(ans[0],ans[i],ans[i+1]);
}
return res/2;
}
int main(){
cin>>n;
while(n--){
cin>>m;
for(int i = 0;i<m;i++) cin>>pg[i].x>>pg[i].y;
for(int i = 0;i<m;i++){
Line[cnt++] = {pg[i],pg[(i+1)%m]};
}
}
double res =half_plane_insection();
printf("%.3lf",res);
}