#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const double PI = acos(-1), EPS = 1e-12, M = 1e6;
struct Point {
  double x, y, alp;
  Point(double x, double y) : x(x), y(y), alp(atan2(y, x)) {}
  Point() = default;
};
inline Point operator+(const Point &a, const Point &b) {
  return {a.x + b.x, a.y + b.y};
}
inline Point operator-(const Point &a, const Point &b) {
  return {a.x - b.x, a.y - b.y};
}
inline Point operator*(const Point &a, double b) { return {a.x * b, a.y * b}; }
inline Point operator/(const Point &a, double b) { return {a.x / b, a.y / b}; }
inline double cross(const Point &a, const Point &b) {
  return a.x * b.y - a.y * b.x;
}
inline double dot(const Point &a, const Point &b) {
  return a.x * b.x + a.y * b.y;
}
inline double dis(const Point &a) { return sqrt(dot(a, a)); }
inline double angle(const Point &a, const Point &b) {
  return acos(dot(a, b) / dis(a) / dis(b));
}
inline double polar(const Point &a) { return a.alp; }
inline double slope(const Point &a, const Point &b) {
  return (b.y - a.y) / (b.x - a.x);
}
Point a[N * 4], p, w[N * 4];
int idx = 0;
struct Line {
  Point x, d;
} b[N * 4], q[N * 4];
bool ins(Point x, Point y) {
  double tt = cross(y - x, p - x);
  if (abs(tt) < EPS) return 0;
  if (tt > 0)
    b[++idx] = {x, y - x};
  else
    b[++idx] = {y, x - y};
  return 1;
}
inline bool chk(Point x, Line l) { return cross(l.d, x - l.x) > 0; }
Point inter(Line x, Line y) {
  Point xx = x.x - y.x;
  return x.x + x.d * (cross(xx, y.d) / cross(y.d, x.d));
}
double HPI() {
  int f, e;
  sort(b + 1, b + idx + 1, [](Line a, Line b) {
    return abs(polar(a.d) - polar(b.d)) < EPS ? chk(a.x, b)
                                              : polar(a.d) < polar(b.d);
  });
  q[f = e = 1] = b[1];
  for (int i = 2; i <= idx; i++) {
    if (abs(polar(b[i].d) - polar(b[i - 1].d)) < EPS) continue;
    while (f < e && !chk(w[e], b[i])) --e;
    while (f < e && !chk(w[f + 1], b[i])) ++f;
    q[++e] = b[i];
    w[e] = inter(q[e], q[e - 1]);
  }
  while (f < e && !chk(w[e], q[f])) --e;
  w[f] = inter(q[f], q[e]);
  if (f > e) return 0;
  w[e + 1] = w[f];
  double ret = 0;
  for (int i = f; i <= e; i++) ret += cross(w[i], w[i + 1]);
  return abs(ret) / 2;
}
int main() {
  ios::sync_with_stdio(false);
  int T;
  scanf("%d", &T);
  while (T--) {
    idx = 0;
    Point p1 = {M, M}, p2 = {-M, M}, p3 = {-M, -M}, p4 = {M, -M};
    b[++idx] = {p1, p2 - p1};
    b[++idx] = {p2, p3 - p2};
    b[++idx] = {p3, p4 - p3};
    b[++idx] = {p4, p1 - p4};
    int n;
    scanf("%d", &n);
    --n;
    scanf("%lf%lf", &p.x, &p.y);
    for (int i = 1; i <= n; i++)
      scanf("%lf%lf", &a[i].x, &a[i].y), a[i] = a[i] - p;
    sort(a + 1, a + n + 1,
         [](Point a, Point b) { return polar(a) < polar(b); });
    int fl = 0;
    for (int i = 1; i <= n; i++) {
      a[i + n] = a[i];
      ins(a[i] + p, a[i + 1] + p);
      if (abs(polar(a[i]) - polar(a[i + 1])) < EPS) fl = 1;
    }
    for (int i = 1, j = 2; i <= n; i++) {
      while (j < i + n && cross(a[j] - a[i], a[i]) < EPS) ++j;
      if (i != j - 1 && !ins(a[i] + p, a[j - 1] + p)) fl = 1;
    }
    printf("%.12lf\n", fl ? 0 : HPI());
  }
  return 0;
}
