$$$112358$$$ is a team from Hunan University that participated in this year's ICPC WuHan station.
Why this name? Because zmy is very fond of playing a game called $$$112358$$$.
![]() | ![]() |
The rules of the game are as follows:
There are a total of 16 squares, and each move can shift the tiles up, down, left, or right. If two adjacent numbers satisfy the condition that they are consecutive terms in the $$$\bf{Fibonacci\ sequence}^\dagger$$$, they will merge into their sum, and the score increases by the value of the new number.
After each move, you can either add a new number $$$1$$$, or not add at all. Note that the newly added $$$1$$$ is not included in the total score.
Now, given a current board state of the $$$112358$$$ game, you are asked to output the current score modulo 998244353.
$$$^\dagger$$$ The Fibonacci sequence is defined as
$$$$$$F_1 = 1,\ \ \ F_2 = 1,\ \ \ F_i = F_{i-1} + F_{i-2} \ \text{for all } i \ge 3.$$$$$$
The first $$$10$$$ terms are $$$[1,\ 1,\ 2,\ 3,\ 5,\ 8,\ 13,\ 21,\ 34,\ 55].$$$
$$$4$$$ rows and $$$4$$$ columns, totaling $$$16$$$ numbers $$$a_{i,j}\ (0 \le a_{i,j} \le 10^6)$$$, indicating that the element in the i-th row and j-th column is $$$F_{a_{i,j}}$$$.
Specifically, $$$a_{i,j}=0$$$ means the current position is empty.
One line with a number — the current score, modulo $$$998244353$$$.
1 2 0 0 0 0 0 0 3 4 0 1 0 0 6 0
32
1. The real current board state is shown below:
| $$$1$$$ | $$$1$$$ | $$$0$$$ | $$$0$$$ |
| $$$0$$$ | $$$0$$$ | $$$0$$$ | $$$0$$$ |
| $$$2$$$ | $$$3$$$ | $$$0$$$ | $$$1$$$ |
| $$$0$$$ | $$$0$$$ | $$$8$$$ | $$$0$$$ |
Some examples about the rule of points:
2. In this problem, $$$a$$$ modulo $$$p$$$ refers to taking the remainder of $$$a$$$ after division by $$$p$$$. For example:
| Название |
|---|


