#Lutece2962. Redcrown's math problem II

Redcrown's math problem II

Migrated from Lutece 2962 Redcrown's math problem II

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

You are given five integer sequences $A=(A_1,...,A_n),B=(B_1,...,B_n),C=(C_1,...,C_n),D=(D_1,...,D_n),E=(E_1,...,E_n)$ of length nn.

Find the following value modulo 998244353.

$\sum^n_{i=1} \sum^n_{j=1} \sum^n_{k=1} \sum^n_{l=1} \sum^n_{m=1} \operatorname{med}(A_i,B_j,C_k,D_l,E_m)$

Here, med(a,b,c,d,e)\operatorname{med}(a,b,c,d,e) represents the median of a,b,c,d,ea,b,c,d,e.

Input

Input consist of 66 lines.

The first line contains one integer number nn indicate the length of five integer sequences.

Each line of the following five lines contains nn integer numbers, indicate a sequence.

Output

Print the answer.

Samples

1
1
2
3
4
5
3
3
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
486

Constraints

It's guaranteed that 1n1051 \le n \le 10^5 , 0Ai,Bi,Ci,Di,Ei1090 \le A_i,B_i,C_i,D_i,E_i \le 10^9

Resources

2023暑期前集训第一次队内赛