t = int(input())
for i in range(t):
k = int(input())
n = int(input())
arr=[[0 for i in range(n)]for i in range(k+1)]
for q in range(n): #0์ธต์ ์ธ์์ ์ฑ์ฐ๊ธฐ.
arr[0][q] = q+1
for j in range(1,k+1): #0์ธต์ ์ธ์์๋ฅผ ๋ํด 1์ธต...2์ธต.... ์์๊ฐ๋ ๋ฐ๋ณต๋ฌธ
for z in range(n):
arr[j][z] += sum(arr[j-1][:z+1])
print(arr[k][n-1])