You're given two integers $$$n,m$$$.
Count the number of different arrays $$$a$$$ of size $$$n$$$ satisfy:
Since the answer may be very large,output the answer modulo $$$10^9+7$$$.
The first line of input will contain a single integer $$$t(1 \leq t \leq 10^5)$$$, denoting the number of test cases.
The only line of each test case contains two integers $$$n,m(3 \leq n \leq m \leq 10^6)$$$.
For each test case,output on a new line — the number of different arrays satisfy the conditions above (modulo $$$10^9+7$$$).
5 3 3 3 4 3 5 500000 1000000 900000 1000000
1 0 3 998348142 469853029
Test case $$$1$$$:
There's only one array $$$\{1,1,1\}$$$ satisfying the conditions above.
Test case $$$2$$$:
No array satisfies the conditions above.
Test case $$$3$$$:
There're $$$3$$$ arrays $$$\{1,2,2\},\{2,1,2\},\{2,2,1\}$$$ satisfying the conditions above.
| Name |
|---|


