Strawberry
题号:NC214781
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 1024 M,其他语言2048 M
64bit IO Format: %lld

题目描述

Farmer Wowo is going to collect strawberries. The farm contains rows and columns. The intersection of the -th row and the -th column is denoted as cell . Initially, there is no strawberry on the farm. Beginning on the morning of the first day, a new strawberry grows from each cell every morning.

Wowo's home is at . Every afternoon, Wowo can move to one of the adjacent grids (left, right, up, or down) or stay where he is. Every evening, Wowo collects all strawberries in his current cell. After the collection, the number of strawberries in that cell becomes 0. The last collection will be in the -th day's evening.

The question is what the maximum number of strawberries Wowo can collect is. Please output the answer mod 998244353.

输入描述:

The first line contains one integer  -- the number of test cases.

Each test case contains 5 integers , , , .

输出描述:

For each test case, output one integer -- the maximum number of strawberries Wowo can collect. Please output the answer mod 998244353.
示例1

输入

复制
5
2 2 1 1 1
2 2 1 1 2
2 2 1 1 3
2 2 1 1 4
2 2 1 1 5

输出

复制
1
3
6
10
14