| 2025 ICPC, Chula Selection Contest |
|---|
| Закончено |
An array $$$a = [a_1,a_2,\dots , a_n]$$$ of length $$$n$$$ is exotic if and only if these two conditions are satisfied.
You are given two integers $$$n$$$ and $$$m$$$. Count the number of exotic arrays $$$a$$$ of length $$$n$$$. Since the answer can be very large, print it modulo $$$10^9 + 7$$$.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases.
Each of the next $$$t$$$ lines contains two integers $$$n$$$, $$$m$$$ ($$$1 \le n, m \le 10^9$$$) — the length of the array and the maximum allowed value.
For each test case, print a single integer — the number of exotic arrays $$$a$$$ modulo $$$10^9 + 7$$$.
61 52 22 13 55 7998244353 1000000000
52031283724174902
In the first test case, $$$n = 1$$$. Every array of length $$$1$$$ is exotic. The answer is $$$5$$$.
In the second test case, $$$n = 2$$$, $$$m = 2$$$. The exotic arrays are $$$[1, 2]$$$ and $$$[2, 2]$$$.
In the third test case, $$$n = 2$$$, $$$m = 1$$$. No exotic arrays exist.
| Название |
|---|


