P8958 "CGOI-3" Ferocious Sanctuary.
Background
After finally clearing the Spring 2 Heart Gate, ac arrived at Spring 3 and decided to predict the difficulty of Ferocious Sanctuary.
[](//www.bilibili.com/video/BV1Cg411v7Ji)
Description
To clear Ferocious Sanctuary, ac needs to perform $n$ operations during the next $2n$ moments. The $i$-th operation requires pressing a key at time $l_i$, then holding this key until releasing it at time $r_i$ ($l_i
Input Format
The first line contains an integer $n$, representing the number of intervals.
The second line contains $2n$ integers $a_i$, with the meaning described above.
Output Format
Output one integer in one line, representing the answer modulo $998244353$.
Explanation/Hint
#### Sample Explanation
For sample 1, there are only two possible interval groups:
1. $[1,2],[3,4]$, the clearing difficulty is $a_1a_2+a_3a_4=1612986$。
2. $[1,4],[2,3]$, the clearing difficulty is $a_1a_4+a_2a_3=1078706$。
The sum of difficulties is $1612986+1078706=2691692$, and modulo $998244353$ it is still $2691692$.
The following cases are invalid:
1. $[3,4],[1,2]$, because $l_i$ is required to be strictly increasing, but $l_1\ge l_2$。
2. $[1,1],[2,4]$, because $l_i