Alice flips a fair coin many times and records the results as a binary string, where '0' represents tails and '1' represents heads.
After looking at the string, she counts how many times each adjacent pair appears:
Your task is to determine how many different binary strings satisfy these counts.
The first line contains an integer $$$t$$$ — the number of test cases.
Each test case consists of one line containing four integers $$$a, b, c, d$$$ $$$(1 \le a+b+c+d \le 5 \cdot 10^5)$$$. It is guaranteed that the sum of all $$$a+b+c+d$$$ across all test cases is less than $$$5\cdot 10^5$$$
For each test case, output a single integer — the number of binary strings in which '00' appears $$$a$$$ times, '01' appears $$$b$$$ times, '10' appears $$$c$$$ times, and '11' appears $$$d$$$ times.
51 1 1 10 2 1 03 0 0 30 0 3 02 3 4 5
4 1 0 0 560
| Name |
|---|


