P16837 [HackerEarth] Instead of one grid various square grids of odd length came into existence later after the old grid was recovered. Now researchers came to know that for such grids the sum of all the num
普及-
题目描述

Instead of one grid various square grids of odd length came into existence later after the old grid was recovered. Now researchers came to know that for such grids the sum of all the numbers except the middle element is equal to the middle element of the grid. Now since all numbers are disappeared so you need to find total possible solutions the grid can possess. Remember that each element of the grid solution should possess only non negative numbers
Input
First line contains t (test cases) ,next t lines contain N and M as input , N will be odd and is the size of the grid and M is the value of the middle element of the grid
Output
You have to output count of total solutions that the grid can posses mod 10^9+7.
Scoring
1≤ t,N,M ≤ 10 20pts
1≤ t,N,M ≤ 100 30pts
1≤ t ≤ 10^5 , 1≤ N,M ≤ 10^3 50pts

SAMPLE INPUT
1
3 1

SAMPLE OUTPUT
8

Explanation

The all possible solutions to the grid are insert 1 in 8 distinct positions and fill rest with zeros.

输入格式

见题面

输出格式

见题面

样例输入
10 7 5 4 4 7 1 6 5 7 8 5 10 1 3 8 1 6 7 5 5
样例输出
4950 481256764 818959756 63 211928504 817190 7770 6 87541245 7888725