#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 .
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, represents the median of .
Input
Input consist of lines.
The first line contains one integer number indicate the length of five integer sequences.
Each line of the following five lines contains 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 ,
Resources
2023暑期前集训第一次队内赛