Ta định nghĩa hai hàm $(x)_n$ và $(x)^n$ như sau: $$(x)_n = \overbrace {x(x - 1)(x - 2)...(x - n + 1)}^{n{\rm{factors}}}$$ $$(x)^n = \overbrace {x(x + 1)(x + 2)...(x + n - 1)}^{n{\rm{factors}}}$$ Cho $x$ và $n$, tính $(x)_n \times (x^n)$ modulo $10^9+7$. #### Input - Dòng 1: $t$ ($t \leq 10$) - số test; - $t$ dòng tiếp theo, mỗi dòng chứa hai số nguyên dương $x$ và $n$ ($n \leq x$). #### Output - Ứng với mỗi test in ra đáp án modulo $(10^9+7)$. #### Scoring - Subtask 1 ($10\%$): $x \leq 10$; - Subtask 2 ($10\%$): $x \leq 10^3$; - Subtask 3 ($10\%$): $x \leq 10^5$; - Subtask 4 ($70\%$): $x \leq 2\times 10^9$. #### Example **Input** ``` 2 3 2 4 3 ``` **Output** ``` 72 2880 ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up