Sherlock and Permutations
Difficulty: Hard

Watson asks Sherlock:  
Given a string _S_ of _N_ `0's` and _M_ `1's`, how many unique permutations of this string start with `1`?   

Help Sherlock by printing the answer modulo (_10<sup>9</sup>+7_).   

**Input Format**   
First line contains _T_, the number of test cases.  
Each test case consists of _N_ and _M_ separated by a space.

**Output Format**   
For each test case, print the answer modulo (_10<sup>9</sup>+7_).

**Constraints**  
1 &le; T &le; 200  
1 &le; N,M &le; 1000  

**Sample Input**   

	2
	1 1
	2 3
    
**Sample Output**      
	
    1
    6

**Explanation**  
Test1: Out of all unique permutations ie. `01` and `10`, only second permutation satisfies. Hence, output is 1.  
Test2: Out of all unique permutations ie. `00111 01011 01101 01110 10011 10101 10110 11001 11010 11100`, only `10011 10101 10110 11001 11010 11100` satisfy. Hence, output is 6.

Input Format:

Output Format:

Sample Input:

Sample Output:

Python 3 starter code:
#
# Complete the 'solve' function below.
#
# The function is expected to return an INTEGER.
# The function accepts following parameters:
#  1. INTEGER n
#  2. INTEGER m
#

def solve(n, m):
    # Write your code here




Reference solution (C++):
###C++  
```cpp  
//Language: C++
//Author: xorfire(R Goutham)
    
#include <cstdio>
#include <cassert>
int mod = 1000000007, comb[2001][2001];
int main()
{
      // Computing Binomial coefficients
      for (int i = 0; i <= 2000; i++)
      {
            comb[i][0] = comb[i][i] = 1;
            for (int j = 1; j < i; j++)
            {
                  comb[i][j] = comb[i-1][j] + comb[i-1][j-1];
                  if (comb[i][j] >= mod) comb[i][j] -= mod;
            }
      }
      int t; scanf("%d", &t);
      while (t--)
      {
            int n, m; scanf("%d%d", &n, &m);
            assert(1 <= n and 1 <= m and n + m - 1 <= 2000);
            printf("%d\n", comb[n + m - 1][n]);
      }
      return 0;
}
```