题目描述
Sherry likes matrices a lot, but her favorite ones are humble matrices. An $N\times M$ matrix (we'll call it $\mbox{A}$) is humble if:
It contains all the elements in range $[1,N\times M]$ exactly once.
For any $2$ elements $(i_1,j_1)$ and $(i_2,j_2)$ in matrix $\mbox{A}$:
If $i_{1}+j_{1}<i_{2}+j_{2}$ , then $A_{i_1,j_1}<A_{i_2,j_2}$ should hold.
Given $N$ and $\mbox{M}$, find and print the total number of possible humble matrices; as this number can be quite large, print your answer modulo $10^9+7$.
Input Format
Two space-separated integers, $N$ and $\mbox{M}$, respectively.
Constraints
$1\leq N,M\leq10^{6}$
Scoring
$1\leq N,M\leq10^3$ for $30\%$ of the test data.
$1\leq N,M\leq10^{6}$ for $100\%$ of the test data.
Output Format
Print the total number of humble matrices possible, modulo $10^9+7$.
Sample Input 0
2 2
Sample Output 0
2
Sample Input 1
3 2
Sample Output 1
4
Explanation
There are $2$ possible $2\times2$ humble matrices:
[ 1, 2 ]
[ 3, 4 ]
[ 1, 3 ]
[ 2, 4 ]
Thus, we print the result of $2\%(10^9+7)$, which is $2$.
输入格式
见题面
输出格式
见题面