Under construction

Still being built. Things may change

Eureka

Time limit5sMemory limit64 MB

Summary
Count the subsets of n labeled points that contain a pair whose segment covers every other chosen point, modulo 1e9+7.
Level

Medium6 of 10

Topics
Geometry, Sorting, Math
Solved
No attempts yet

Problem

Professor Zhang draws nn points on the plane, labeled 1,2,…,n1, 2, \ldots, n. The ii-th point is at (xi,yi)(x_i, y_i). Professor Zhang wants to count the best sets modulo 109+710^9 + 7.

A set PP of point labels is a best set if and only if PP contains at least one best pair. Two distinct labels uu and vv (u,v∈Pu, v \in P, u≠vu \ne v) form a best pair if, for every w∈Pw \in P, f(u,v)≥g(u,v,w)f(u, v) \ge g(u, v, w), where f(u,v)=(xu−xv)2+(yu−yv)2f(u, v) = \sqrt{(x_u - x_v)^2 + (y_u - y_v)^2} and g(u,v,w)=f(u,v)+f(v,w)+f(w,u)2g(u, v, w) = \frac{f(u, v) + f(v, w) + f(w, u)}{2}.

Input

There are multiple test cases. The first line contains an integer TT, the number of test cases. Each test case begins with an integer nn (1≤n≤10001 \le n \le 1000), the number of points, followed by nn lines that each contain two integers xix_i and yiy_i (−109≤xi,yi≤109-10^9 \le x_i, y_i \le 10^9). There are no more than 250250 test cases, and the sum of nn over all test cases is at most 40 00040\,000.

Output

For each test case, print the number of best sets modulo 109+710^9 + 7 on its own line.

Examples1

  1. Example 1

    Input
    3
    3
    1 1
    1 1
    1 1
    3
    0 0
    0 1
    1 0
    1
    0 0
    
    Expected output
    4
    3
    0