Số thập nhị phân

View as PDF

Points: 100 Time limit: 1.0s Memory limit: 640M Input: stdin Output: stdout

Hãy đếm có bao nhiêu số tự nhiên chỉ chứa các chữ số \(0\)\(1\), sao cho số đó có \(n\) số \(0\)\(m\) số \(1\).

Input

  • \(t(t \le 1000)\) - số test
  • mỗi test chứa \(2\) số nguyên dương \(n, m (n,m \le 1000)\)

Output

  • Số các số thỏa mãn % \((10^9+7)\)

Example

Test 1

Input
2
1 1
2 3
Output
1
6

Comments

There are no comments at the moment.