Polynomial Game

For each test case, compute the coefficient of x^N in the product of (1+x+...+x^i) for i from 1 to k.

Medium4Dynamic programmingCombinatoricsInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

Heehyun and Jugyeong like the polynomial game.

In the polynomial game you are given an integer kk and the polynomial

p(x)=(1+x)(1+x+x2)(1+x+x2+x3)(1+x++xk1+xk)p(x) = (1+x)(1+x+x^2)(1+x+x^2+x^3)\cdots(1+x+\cdots+x^{k-1}+x^k)

The first player to say the coefficient of xNx^N in p(x)p(x) wins.

Help Heehyun beat Jugyeong.

Input

The first line contains the number of test cases TT (1T20001 \le T \le 2000).

Each of the next TT lines contains two integers kk and NN separated by a space (1k201 \le k \le 20, 0Nk(k+1)/20 \le N \le k(k+1)/2).

Output

For each test case, print the coefficient of xNx^N in p(x)p(x) on its own line.