Geometrical Combinatorics

아직 제출이 없습니다시간 제한3초메모리 제한512 MB

문제

Grace is developing a brand new theory of geometrical combinatorics --- a study about geometrical properties of combinatoric objects. 

Consider two triangles on plane --- a Pascal's triangle and an ordinary triangle. Pascal's triangle is drawn with it's root at point (0, 0), and two sides along diagonals of upper-halfplane quarters. Formally, there are 1's written in points (i,i)(i, i) and (i,i)(-i, i), and between them at point (i+2k,i)(-i + 2 k, i) there is a number equal to the sum of numbers at (i+2k+1,i1)(-i + 2k + 1, i - 1) and at (i+2k1,i1)(-i + 2k - 1, i - 1) for all kk from 11 to i1i - 1. An ordinary triangle is drawn as just a triangle with vertices at (x_A,y_A)(x\_A, y\_A), (x_B,y_B)(x\_B, y\_B), (x_C,y_C)(x\_C, y\_C)

Grace defines an intersection value of Pascal's triangle and an ordinary triangle as the sum of values of Pascal's triangle inside or on the border of the ordinary triangle. Can you develop a program that calculates this intersection value?

입력

On the first line there is an integer tt (1t51 \le t \le 5) --- the number of tests to process. Each of the next tt lines contains 6 integers x_Ax\_A, y_Ay\_A, x_Bx\_B, y_By\_B, x_Cx\_C, y_Cy\_C (106x_A,y_A,x_B,y_B,x_C,y_C106-10^6 \le x\_A, y\_A, x\_B, y\_B, x\_C, y\_C \le 10^6). Three points in each test do not lie on a line.

출력

For each test output an integer --- the intersection value modulo 109+710^9+7.