How many sequences?
题号:NC214742
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 64 M,其他语言128 M
64bit IO Format: %lld

题目描述

Sister bin has a whim. She wants to find a sequence of positive integers. All the numbers in the sequence are not greater than N, the length of the sequence is M, and all the numbers are not less than the numbers in front of it. Soon she found a sequence like this. But she thought it was not enough. She wanted to know how many such sequences were, but she was scared by the amazing data range. Now that she has found you, please help her solve this problem.

Because the result may be very large, please output the value after taking the modulus of 1e9 + 7.

输入描述:

The first line contains one integer T(T ≤ 1,000), the number of test cases.
For each test case, there are two integers in one line in the following format:
N M
(1≤ N, M ≤ 106 )

输出描述:

For each group of test data, the output line contains an integer representing the number of sequences that meet the conditions after taking the modulus of 1e9 + 7.

示例1

输入

复制
4
1 1
3 3
2 3
3 1

输出

复制
1
10
4
3