Pascal Matrix Power

No attempts yetTime limit1sMemory limit128 MB

Problem

The Pascal matrix is infinite in size, and its rows and columns are numbered from 0. Each entry is defined as follows.

Pascal[row, column] = Comb(row, column)   (0 ≤ column ≤ row)

Every position outside that range holds 0. Comb(n, k) is the number of ways to choose k items out of n distinct items.

1000000000...
1100000000...
1210000000...
1331000000...
1464100000...
151010510000...
1615201561000...
17213535217100...
182856705628810...
193684126126843691...
...........
...........
...........

Let PascalP be the product of PP copies of the Pascal matrix.

PascalP = Pascal × Pascal × ... × Pascal

Write a program that computes a single entry of PascalP.

Input

The first line contains the number of test cases KK (1K10001 \leq K \leq 1000).

Each of the next KK lines holds one test case as four integers. The first integer is the test case number, the second integer is PP (1P1000001 \leq P \leq 100000), and the third and fourth integers are RR and CC (0CR1000000 \leq C \leq R \leq 100000).

Output

For each test case, print the test case number and the entry of PascalP at row RR, column CC on one line, separated by a single space.

Only inputs whose answer fits in a 64-bit integer are given.