P17231 [Math×Girl²] Coloring⁴
Background

Description
You are given a $ka\times kb\times kc\times kd$ four-dimensional grid, where each cell can only be black or white.
How many coloring schemes are there such that, in every $k\times k\times k\times k$ subgrid, there are **exactly** $1$ black cell?
Since the answer may be very large, you only need to output the result modulo $998244353$.
Input Format
The first line contains an integer $T$, the number of test cases.
The next $T$ lines each contain five integers $k,a,b,c,d$, and it is guaranteed that $a\le b\le c\le d$.
Output Format
Output $T$ lines, each containing one integer: the number of schemes modulo $998244353$.
Explanation/Hint
### Sample Explanation
See [Coloring³](https://www.luogu.com.cn/problem/P17230) for details.
### Constraints and Notes
|Test Point|Score|$k$|$d$|Special Property|
|:-:|:-:|:-:|:-:|:-:|
|$1$| $1$|$k=1$| - | - |
|$2$| $4$| - |$d=2$|$(a,b,c)=(2,2,2)$|
|$3$| $5$| - |$d\le20$|^|
|$4$| $5$|$k=2$| - |^|
|$5$|$10$| - | - |^|
|$6$| $5$|$k=2$| - |$(a,b,c)=(2,2,3)$|
|$7$|$10$| - | - |^|
|$8$| $5$|$k=2$| - |$(a,b,c)=(2,2,4)$|
|$9$|$10$|$k=3$| - |^|
|$10$|$10$|$k=2$| - |$(a,b,c)=(2,2,5)$|
|$11$|$10$|$k=2$| - |$(a,b,c)=(2,2,6)$|
|$12$|$5$|$k=2$| - |$(a,b,c)=(2,3,3)$|
|$13$|$10$|$k=2$| - |$(a,b,c)=(2,3,4)$|
|$14$|$10$|$k=2$| - |$(a,b,c)=(3,3,3)$|
For $100\%$ of the testdata: $1\le T\le3$, $1\le k