#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400010;
const long double X = 1e6;
const long double eps = 1e-13;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
inline int sgn(long double x) {
  if (x > eps) return 1;
  if (x < -eps) return -1;
  return 0;
}
int n, id[MAXN], collinear, tot;
long double pol[MAXN];
struct point {
  long double x, y;
  point() {}
  point(long double _x, long double _y) : x(_x), y(_y) {}
  friend point operator+(point a, point b) {
    return point(a.x + b.x, a.y + b.y);
  }
  friend point operator-(point a, point b) {
    return point(a.x - b.x, a.y - b.y);
  }
  friend point operator*(point a, long double b) {
    return point(a.x * b, a.y * b);
  }
  friend long double operator^(point a, point b) {
    return a.x * b.y - a.y * b.x;
  }
} p[MAXN], p2[MAXN];
inline bool polar_cmp(int x, int y) {
  if (sgn(pol[x] - pol[y]) == 0) collinear = 1;
  return pol[x] < pol[y];
}
struct line {
  point u, v;
  long double ang;
  line() {}
  line(point _u, point _v) : u(_u), v(_v) { ang = atan2(v.y - u.y, v.x - u.x); }
  friend bool operator<(line a, line b) {
    return (sgn(a.ang - b.ang) == 0) ? (sgn((a.v - a.u) ^ (b.v - a.u)) < 0)
                                     : (a.ang < b.ang);
  }
} l[MAXN], q[MAXN];
inline point Intersect(line a, line b) {
  long double k = -((a.u - b.u) ^ (b.v - b.u)) / ((a.v - a.u) ^ (b.v - b.u));
  return a.u + (a.v - a.u) * k;
}
inline bool Check(line a, line b, line c) {
  point inter = Intersect(a, b);
  return sgn((c.v - c.u) ^ (inter - c.u)) < 0;
}
long double HalfPlane() {
  sort(l + 1, l + tot + 1);
  int tmp = 0, head, tail;
  for (int i = 1; i <= tot; ++i) {
    if (i == 1 || sgn(l[i].ang - l[i - 1].ang)) {
      l[++tmp] = l[i];
    }
  }
  tot = tmp;
  q[head = tail = 1] = l[1];
  for (int i = 2; i <= tot; ++i) {
    while (head < tail && Check(q[tail - 1], q[tail], l[i])) --tail;
    while (head < tail && Check(q[head + 1], q[head], l[i])) ++head;
    q[++tail] = l[i];
  }
  while (head < tail && Check(q[tail - 1], q[tail], q[head])) --tail;
  while (head < tail && Check(q[head + 1], q[head], q[tail])) ++head;
  tot = 0;
  q[tail + 1] = q[head];
  for (int i = head; i <= tail; ++i) {
    p[++tot] = Intersect(q[i], q[i + 1]);
  }
  long double ret = 0;
  p[tot + 1] = p[1];
  for (int i = 1; i <= tot; ++i) {
    ret += (p[i] ^ p[i + 1]);
  }
  return fabs(ret * 0.5);
}
void init() {
  read(n);
  for (int i = 1, x, y; i <= n; ++i) {
    read(x);
    read(y);
    p[i] = point(x, y);
  }
}
void solve() {
  for (int i = 2; i <= n; ++i) {
    p2[i] = p[i] - p[1];
    pol[i] = atan2(p2[i].y, p2[i].x);
    id[i] = i;
  }
  tot = collinear = 0;
  sort(id + 2, id + n + 1, polar_cmp);
  if (collinear) {
    printf("0.0000000000\n");
    return;
  }
  for (int i = 2; i <= n; ++i) {
    id[n + i - 1] = id[i];
  }
  for (int i = 2, j = i; i <= n; ++i) {
    if (j < i) j = i;
    while (j + 1 < n + i - 1 && sgn(p2[id[i]] ^ p2[id[j + 1]]) >= 0) {
      ++j;
    }
    if (j > i) {
      if (sgn(p2[id[i]] ^ p2[id[j]]) == 0) {
        printf("0.0000000000\n");
        return;
      }
      l[++tot] = line(p[id[i]], p[id[i + 1]]);
      l[++tot] = line(p[id[i]], p[id[j]]);
    }
  }
  l[++tot] = line(point(X, X), point(-X, X));
  l[++tot] = line(point(-X, X), point(-X, -X));
  l[++tot] = line(point(-X, -X), point(X, -X));
  l[++tot] = line(point(X, -X), point(X, X));
  printf("%.10lf\n", (double)HalfPlane());
}
int main() {
  int T;
  read(T);
  while (T--) {
    init();
    solve();
  }
  return 0;
}

### Prompt

Construct a cpp code solution to the problem outlined:

Bearland is a big square on the plane. It contains all points with coordinates not exceeding 106 by the absolute value.

There are n houses in Bearland. The i-th of them is located at the point (xi, yi). The n points are distinct, but some subsets of them may be collinear.

Bear Limak lives in the first house. He wants to destroy his house and build a new one somewhere in Bearland.

Bears don't like big changes. For every three points (houses) pi, pj and pk, the sign of their cross product (pj - pi) × (pk - pi) should be the same before and after the relocation. If it was negative/positive/zero, it should still be negative/positive/zero respectively. This condition should be satisfied for all triples of indices (i, j, k), possibly equal to each other or different than 1. Additionally, Limak isn't allowed to build the house at the point where some other house already exists (but it can be the point where his old house was).

In the formula above, we define the difference and the cross product of points (ax, ay) and (bx, by) as: 

(ax, ay) - (bx, by) = (ax - bx, ay - by),  (ax, ay) × (bx, by) = ax·by - ay·bx.

Consider a set of possible new placements of Limak's house. Your task is to find the area of that set of points.

Formally, let's say that Limak chooses the new placement randomly (each coordinate is chosen independently uniformly at random from the interval [ - 106, 106]). Let p denote the probability of getting the allowed placement of new house. Let S denote the area of Bearland (S = 4·1012). Your task is to find p·S.

Input

The first line of the input contains an integer T (1 ≤ T ≤ 500) — the number of test cases. The description of the test cases follows.

The first line of the description of a test case contains an integer n (3 ≤ n ≤ 200 000) — the number of houses.

The i-th of the next n lines contains two integers xi and yi ( - 106 ≤ xi, yi ≤ 106) — coordinates of the i-th house. No two houses are located at the same point in the same test case. Limak lives in the first house.

The sum of n won't exceed 200 000.

Output

Print one real value, denoting the area of the set of points that are possible new placements of Limak's house.

Your answer will be considered correct if its absolute or relative error doesn't exceed 10 - 6. More precisely, let the jury's answer be b, and your answer be a. Then your answer will be accepted if and only if <image>.

Example

Input

4
4
5 3
0 1
10 1
3 51
3
-999123 700000
-950000 123456
-950000 987654
3
2 3
10 -1
-4 6
5
1 3
5 2
6 1
4 4
-3 3


Output

250.000000000000
100000000000.000000000000
0.000000000000
6.562500000000

Note

In the sample test, there are 4 test cases.

In the first test case, there are four houses and Limak's one is in (5, 3). The set of valid new placements form a triangle with vertices in points (0, 1), (10, 1) and (3, 51), without its sides. The area of such a triangle is 250.

In the second test case, the set of valid new placements form a rectangle of width 50 000 and height 2 000 000. Don't forget that the new placement must be inside the big square that represents Bearland.

In the third test case, the three given points are collinear. Each cross product is equal to 0 and it should be 0 after the relocation as well. Hence, Limak's new house must lie on the line that goes through the given points. Since it must also be inside the big square, new possible placements are limited to some segment (excluding the two points where the other houses are). The area of any segment is 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400010;
const long double X = 1e6;
const long double eps = 1e-13;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
inline int sgn(long double x) {
  if (x > eps) return 1;
  if (x < -eps) return -1;
  return 0;
}
int n, id[MAXN], collinear, tot;
long double pol[MAXN];
struct point {
  long double x, y;
  point() {}
  point(long double _x, long double _y) : x(_x), y(_y) {}
  friend point operator+(point a, point b) {
    return point(a.x + b.x, a.y + b.y);
  }
  friend point operator-(point a, point b) {
    return point(a.x - b.x, a.y - b.y);
  }
  friend point operator*(point a, long double b) {
    return point(a.x * b, a.y * b);
  }
  friend long double operator^(point a, point b) {
    return a.x * b.y - a.y * b.x;
  }
} p[MAXN], p2[MAXN];
inline bool polar_cmp(int x, int y) {
  if (sgn(pol[x] - pol[y]) == 0) collinear = 1;
  return pol[x] < pol[y];
}
struct line {
  point u, v;
  long double ang;
  line() {}
  line(point _u, point _v) : u(_u), v(_v) { ang = atan2(v.y - u.y, v.x - u.x); }
  friend bool operator<(line a, line b) {
    return (sgn(a.ang - b.ang) == 0) ? (sgn((a.v - a.u) ^ (b.v - a.u)) < 0)
                                     : (a.ang < b.ang);
  }
} l[MAXN], q[MAXN];
inline point Intersect(line a, line b) {
  long double k = -((a.u - b.u) ^ (b.v - b.u)) / ((a.v - a.u) ^ (b.v - b.u));
  return a.u + (a.v - a.u) * k;
}
inline bool Check(line a, line b, line c) {
  point inter = Intersect(a, b);
  return sgn((c.v - c.u) ^ (inter - c.u)) < 0;
}
long double HalfPlane() {
  sort(l + 1, l + tot + 1);
  int tmp = 0, head, tail;
  for (int i = 1; i <= tot; ++i) {
    if (i == 1 || sgn(l[i].ang - l[i - 1].ang)) {
      l[++tmp] = l[i];
    }
  }
  tot = tmp;
  q[head = tail = 1] = l[1];
  for (int i = 2; i <= tot; ++i) {
    while (head < tail && Check(q[tail - 1], q[tail], l[i])) --tail;
    while (head < tail && Check(q[head + 1], q[head], l[i])) ++head;
    q[++tail] = l[i];
  }
  while (head < tail && Check(q[tail - 1], q[tail], q[head])) --tail;
  while (head < tail && Check(q[head + 1], q[head], q[tail])) ++head;
  tot = 0;
  q[tail + 1] = q[head];
  for (int i = head; i <= tail; ++i) {
    p[++tot] = Intersect(q[i], q[i + 1]);
  }
  long double ret = 0;
  p[tot + 1] = p[1];
  for (int i = 1; i <= tot; ++i) {
    ret += (p[i] ^ p[i + 1]);
  }
  return fabs(ret * 0.5);
}
void init() {
  read(n);
  for (int i = 1, x, y; i <= n; ++i) {
    read(x);
    read(y);
    p[i] = point(x, y);
  }
}
void solve() {
  for (int i = 2; i <= n; ++i) {
    p2[i] = p[i] - p[1];
    pol[i] = atan2(p2[i].y, p2[i].x);
    id[i] = i;
  }
  tot = collinear = 0;
  sort(id + 2, id + n + 1, polar_cmp);
  if (collinear) {
    printf("0.0000000000\n");
    return;
  }
  for (int i = 2; i <= n; ++i) {
    id[n + i - 1] = id[i];
  }
  for (int i = 2, j = i; i <= n; ++i) {
    if (j < i) j = i;
    while (j + 1 < n + i - 1 && sgn(p2[id[i]] ^ p2[id[j + 1]]) >= 0) {
      ++j;
    }
    if (j > i) {
      if (sgn(p2[id[i]] ^ p2[id[j]]) == 0) {
        printf("0.0000000000\n");
        return;
      }
      l[++tot] = line(p[id[i]], p[id[i + 1]]);
      l[++tot] = line(p[id[i]], p[id[j]]);
    }
  }
  l[++tot] = line(point(X, X), point(-X, X));
  l[++tot] = line(point(-X, X), point(-X, -X));
  l[++tot] = line(point(-X, -X), point(X, -X));
  l[++tot] = line(point(X, -X), point(X, X));
  printf("%.10lf\n", (double)HalfPlane());
}
int main() {
  int T;
  read(T);
  while (T--) {
    init();
    solve();
  }
  return 0;
}

```