题目描述
Problem statement
Find the number of integer sequences $ X_1, X_2, ..., X_N $ that satisfy the following conditions.
- For any integer $ i $ ($1 \ leq i \ leq N$), there exists $ j $ ($1 \ leq j \ leq N$) such that $ X_j = i $.
- $ X_s = t $
- $ X_ {a_i} <X_ {b_i} $ ($1 \ leq i \ leq C$)
Constraint
- $1 \ leq N \ leq 2000$
- $0 \ leq C \ leq N$
- $1 \ leq s \ leq N$
- $1 \ leq t \ leq N$
- $1 \ leq a_i \ leq N$
- $1 \ leq b_i \ leq N$
- $a_i \ neq b_i$
- $i \ neq j$ then $a_i \ neq a_j$
input
Input follows the following format. All given numbers are integers.
$ N $ $ C $ $ s $ $ t $
$ a_1 $ $ b_1 $
$ a_2 $ $ b_2 $
$ ... $
$ a_C $ $ b_C $
output
Divide the number of sequences that satisfy the condition by $ 10 ^ 9 + 7 $ and output the remainder on one row (it is easy to show that the number of sequences that satisfy the condition is at most finite).
Examples
Input
3 1 1 1
1 3
Output
2
Input
4 2 1 1
2 3
3 2
Output
0
输入格式
见题面
输出格式
见题面
样例输入
3 1 1 1
1 3
样例输出
2