402796: GYM100883 G Count Mix Strings
Description
While I was working in the company, the internet broke. I didn't have anything to do without internet, so I decided to write this ACM problem.
We need to mix between two strings and also we should keep the same order for both strings.
example: if we have s1 = "ab" and s2 = "cd", we can generate six strings:
abcd acbd
acdb cdab
cadb cabd
but now I have a problem. I need to calculate the complexity for this problem to make input and output files.
you will be given the length of two strings and you should help me to find the number of strings that could be generated (if there is a repeated string, count it every time).
InputYour program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 10000). Followed by the test cases, each test case is on one line. it contains two numbers N and M the length of s1 and s2 where 1 ≤ N, M ≤ 10000
OutputFor each test case, print a single line which contains a single integer that is representing the number of strings that could be generated MOD 10^9+7.
ExamplesInput3Output
1 1
1 2
2 2
2
3
6