#655
Unrated
Cowmpetency
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Farmer John is hiring a new herd leader for his cows. To that end, he has interviewed NN (2N1092 \leq N \leq 10^9) cows for the position. After each interview, he assigned an integer "cowmpetency" score to the candidate ranging from 11 to CC (1C1041 \leq C \leq 10^4) that is correlated with their leadership abilities.

Because he has interviewed so many cows, Farmer John has forgotten all of their cowmpetency scores. However, he does remembers QQ (1Qmin(N1,100)1 \leq Q \leq \min(N - 1, 100)) pairs of numbers (ai,hi)(a_i, h_i) where cow hih_i was the first cow with a strictly greater cowmpetency score than cows 11 through aia_i (so 1ai<hiN1 \leq a_i < h_i \leq N).

Farmer John now tells you the QQ pairs of (ai,hi)(a_i, h_i). Help him count how many sequences of cowmpetency scores are consistent with this information! It is guaranteed that there is at least one such sequence. Because this number may be very large, output its value modulo 109+710^9 + 7.

입력

The first line contains NN, QQ, and CC.

The next QQ lines each contain a pair (ai,hi)(a_i, h_i). It is guaranteed that all aja_j are distinct.

출력

The number of sequences of cowmpetency scores consistent with what Farmer John remembers, modulo 109+710^9+7.

예제 입력 1

6 2 3
2 3
4 5

예제 출력 1

6

예제 입력 2

10 1 20
1 3

예제 출력 2

399988086

점수

Inputs 3-4 satisfy N10N \leq 10 and Q,C4Q, C \leq 4.Inputs 5-7 satisfy N,C100N, C \leq 100.Inputs 8-10 satisfy N2000N \leq 2000 and C200C \leq 200.Inputs 11-15 satisfy N,C2000N, C \leq 2000.Inputs 16-20 satisfy no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.