#P3266. [JLOI2015] 骗我呢

[JLOI2015] 骗我呢

Description

Speaking of which, after graduation, B has only met R twice.

R has an n×mn \times m array xi,jx_{i,j}.

For 1in,1jm1 \le i \le n, 1 \le j \le m, it holds that 0xi,jm0 \le x_{i,j} \le m. Find the number of possible arrays xi,jx_{i,j}.

B thinks the constraints are too loose and additionally requires that for 1in,1j<m1 \le i \le n, 1 \le j < m, we have xi,j<xi,j+1x_{i,j} < x_{i,j+1}; and for 1<in,1j<m1 < i \le n, 1 \le j < m, we have xi,j<xi1,j+1x_{i,j} < x_{i-1,j+1}.

B believes R can just pwn this problem.

R says: "This trolling is way too realistic =.=, at least take the answer modulo 109+710^9+7." B thinks R makes sense, so he asks you to compute the answer modulo 109+710^9+7.

Input Format

A single line with two integers n,mn, m, as described above.

Output Format

A single line with a single number: the count of arrays xi,jx_{i,j} that satisfy both B's and R's conditions, modulo 109+710^9+7.

3 3
40

Hint

For 100%100\% of the testdata, 1n,m1061 \le n, m \le 10^6.

Translated by ChatGPT 5