#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int n;
struct point
{
double x, y;
void write(){printf("%.2lf %.2lf\n", x, y);}
};
point p[1505];
bool h[1505];
double xmul(point a, point b, point c)
{return (c.x - a.x) * (b.y - a.y) - (c.y - a.y) * (b.x - a.x);}
point intersection(point u1,point u2,point v1,point v2){
point ret=u1;
double t=((u1.x-v1.x)*(v1.y-v2.y)-(u1.y-v1.y)*(v1.x-v2.x))
/((u1.x-u2.x)*(v1.y-v2.y)-(u1.y-u2.y)*(v1.x-v2.x));
ret.x+=(u2.x-u1.x)*t;
ret.y+=(u2.y-u1.y)*t;
return ret;
}
void read()
{
scanf("%d", &n);
for(int i = 0; i < n; i ++)
scanf("%lf %lf", &p[i].x, &p[i].y);
p[n] = p[0];
}
double cross(point a, point b)
{return a.x * b.y - a.y * b.x;}
double area(point *p, int n)//面积为负多边形为顺时针给出
{
double sum = 0;
for(int i = 0; i < n; i ++)
sum += cross(p[i], p[i + 1]);
return sum / 2;
}
void pre()
{
point tp[1505];
if(area(p, n) < 0)
{
for(int i = 0; i < n; i ++)
tp[i] = p[n - 1 - i];
tp[n] = tp[0];
for(int i = 0; i <= n; i ++) p[i] = tp[i];
}
}
void solve()
{
int i, j, flag;
double sum;
point tp[1505], tt[1505], ns, ne;
int len = 0, tlen;
point s, e, pp;
memset(h, 0, sizeof(h));
//enum
for(i = 0; i <= n; i ++) tp[i] = p[i];
len = n;
for(i = 0; i < n; i ++)
{
// for(j = 0; j < len; j ++)
// printf("<%.2lf %.2lf> \n",tp[j].x, tp[j].y);
// puts("");
s = p[i]; e = p[i + 1];
tlen = 0;
for(j = 0; j < len; j ++)
{
ns = tp[j]; ne = tp[j + 1];
if(xmul(s, e, ns) <= 0)
tt[tlen ++] = ns;
if(xmul(s, e, ns) * xmul(s, e, ne) < 0)
{
pp = intersection(s, e, ns, ne);
tt[tlen ++] = pp;
}
}
tt[tlen] = tt[0];
for(j = 0; j <= tlen; j ++) tp[j] = tt[j];
len = tlen;
}
//core
tp[len] = tp[0];
sum = area(tp, len);
printf("%.2lf\n", fabs(sum));
}
int main()
{
int test;
scanf("%d", &test);
while(test --)
{
read();
pre();
solve();
}
}