문제
Bessie has () favorite distinct points on a 2D grid, no three of which are collinear. For each , the -th point is denoted by two integers and ().
Bessie draws some segments between the points as follows.
She chooses some permutation of the points.She draws segments between and , and , and and .Then for each integer from to in order, she draws a line segment from to for all such that the segment does not intersect any previously drawn segments (aside from at endpoints).
Bessie notices that for each , she drew exactly three new segments. Compute the number of permutations Bessie could have chosen on step 1 that would satisfy this property, modulo .
입력
The first line contains .
Followed by lines, each containing two space-separated integers and .
출력
The number of permutations modulo .
예제 입력 1
4
0 0
0 4
1 1
1 2
예제 출력 1
0
예제 입력 2
4
0 0
0 4
4 0
1 1
예제 출력 2
24
예제 입력 3
5
0 0
0 4
4 0
1 1
1 2
예제 출력 3
96
점수
Test cases 1-6 satisfy .Test cases 7-20 satisfy no additional constraints.
코드를 제출하려면 로그인이 필요합니다.
로그인