#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const double MAXC = 1e6;
const double INF = 1e30;
bool eq(double a, double b) { return abs(a - b) < EPS; }
bool gr(double a, double b) { return a >= b + EPS; }
bool gr_eq(double a, double b) { return a > b - EPS; }
struct Point {
  double x, y;
  Point() {}
  Point(double xx, double yy) {
    x = xx;
    y = yy;
  }
};
struct Vector {
  double x, y;
  Vector() {}
  Vector(double xx, double yy) {
    x = xx;
    y = yy;
  }
  Vector(Point a, Point b) {
    x = b.x - a.x;
    y = b.y - a.y;
  }
};
double operator*(Vector a, Vector b) { return (a.x * b.x + a.y * b.y); }
double operator%(Vector a, Vector b) { return (a.x * b.y - a.y * b.x); }
Vector operator+(Vector a, Vector b) {
  a.x += b.x;
  a.y += b.y;
  return a;
}
Point operator+(Point a, Vector b) {
  a.x += b.x;
  a.y += b.y;
  return a;
}
struct Line {
  double a, b, c;
  Vector v;
  Point p;
  Line() {}
  Line(Point p1, Point p2) {
    a = -(p2.y - p1.y);
    b = p2.x - p1.x;
    c = -a * p1.x - b * p1.y;
    double d = pow(a * a + b * b, 0.5);
    a /= d;
    b /= d;
    c /= d;
    v = Vector(a, b);
    p = p1;
  }
};
bool point_on_halfplane(Point p, Line& l) {
  if (gr(l.c, -l.a * p.x - l.b * p.y)) {
    return true;
  } else {
    return false;
  }
}
int get_half(Vector& v) {
  if (gr(v.y, 0) || (eq(v.y, 0) && gr(v.x, 0))) {
    return 1;
  } else {
    return 2;
  }
}
bool cmt_v(Vector& v1, Vector& v2) {
  if (get_half(v1) == get_half(v2)) {
    return gr(v1 % v2, 0);
  } else {
    return get_half(v1) < get_half(v2);
  }
}
Point intersect_lines(Line& l1, Line& l2) {
  double d = l1.a * l2.b - l1.b * l2.a;
  if (eq(d, 0)) {
    return Point(INF, INF);
  }
  return Point((l1.b * l2.c - l1.c * l2.b) / d,
               (l1.c * l2.a - l1.a * l2.c) / d);
}
bool cmt_ls(Line& l1, Line& l2) {
  if (get_half(l1.v) != get_half(l2.v)) {
    return get_half(l1.v) < get_half(l2.v);
  }
  if (!eq(l1.v % l2.v, 0)) {
    return gr(l1.v % l2.v, 0);
  }
  if (eq(l1.v % l2.v, 0)) {
    return point_on_halfplane(l1.p, l2);
  }
}
bool eq_ls(Line& l1, Line& l2) {
  return ((get_half(l1.v) == get_half(l2.v)) && (eq(l1.v % l2.v, 0)));
}
void get_polygon(vector<Line>& ls) {
  Point box[4];
  box[0] = Point(MAXC, MAXC);
  box[1] = Point(-MAXC, MAXC);
  box[2] = Point(-MAXC, -MAXC);
  box[3] = Point(MAXC, -MAXC);
  for (int i = 0; i < 4; ++i) {
    ls.push_back(Line(box[i], box[(i + 1) % 4]));
  }
  sort(ls.begin(), ls.end(), cmt_ls);
  auto last = unique(ls.begin(), ls.end(), eq_ls);
  ls.erase(last, ls.end());
  deque<Line> lans;
  for (int i = 0; i < ls.size(); ++i) {
    while ((lans.size() >= 2) &&
           !point_on_halfplane(
               intersect_lines(lans[lans.size() - 1], lans[lans.size() - 2]),
               ls[i])) {
      lans.pop_back();
    }
    while ((lans.size() >= 2) &&
           !point_on_halfplane(intersect_lines(lans[0], lans[1]), ls[i])) {
      lans.pop_front();
    }
    if ((lans.size() >= 1) && !gr(lans[lans.size() - 1].v % ls[i].v, 0)) {
      ls.clear();
      return;
    }
    if ((lans.size() <= 1) ||
        (point_on_halfplane(intersect_lines(lans[lans.size() - 1], ls[i]),
                            lans[0]))) {
      lans.push_back(ls[i]);
    }
  }
  ls.clear();
  for (auto e : lans) {
    ls.push_back(e);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  cout.precision(30);
  for (int o = 0; o < t; ++o) {
    int n;
    cin >> n;
    vector<Point> mas(n);
    for (int i = 0; i < n; ++i) {
      cin >> mas[i].x >> mas[i].y;
    }
    Point main_p = mas[0];
    mas.erase(mas.begin());
    n--;
    vector<Vector> mv(n);
    for (int i = 0; i < n; ++i) {
      mv[i] = Vector(main_p, mas[i]);
    }
    sort(mv.begin(), mv.end(), cmt_v);
    bool extra_fl = false;
    for (int i = 0; i < n; ++i) {
      if (eq(mv[i] % mv[(i + 1) % n], 0)) {
        extra_fl = true;
        break;
      }
    }
    if (extra_fl) {
      cout << 0 << '\n';
      continue;
    }
    int l, r;
    l = r = 0;
    vector<Line> lfp;
    for (int i = 0; i < n; ++i) {
      Line l = Line(main_p + mv[i], main_p + mv[(i + 1) % n]);
      if (point_on_halfplane(main_p, l)) {
        lfp.push_back(l);
      }
    }
    for (; l < n; ++l) {
      while (gr_eq(mv[l] % mv[r % n], 0) && (l + n > r)) {
        r++;
      }
      if (l != (r - 1 + n) % n) {
        lfp.push_back(Line(main_p + mv[l], main_p + mv[(r - 1 + n) % n]));
      }
    }
    get_polygon(lfp);
    vector<Point> pol;
    for (int i = 0; i < lfp.size(); ++i) {
      pol.push_back(intersect_lines(lfp[i], lfp[(i + 1) % lfp.size()]));
    }
    double ans_area = 0;
    for (int i = 0; i < pol.size(); ++i) {
      ans_area += (pol[(i + 1) % pol.size()].y + pol[i].y) *
                  (pol[(i + 1) % pol.size()].x - pol[i].x) / 2;
    }
    cout.precision(30);
    cout << abs(ans_area) << '\n';
  }
  cout << endl;
  return 0;
}
