Given an integer sequence $$$a_1, a_2, \cdots, a_n$$$ of length $$$n$$$, we say a continuous subarray $$$a_l, a_{l + 1}, \cdots, a_r$$$ is good, if the maximum element of the subarray appears exactly $$$k$$$ times in the subarray. For each $$$1 \le k \le n$$$, count the number of good subarrays.
There are multiple test cases. The first line of the input contains an integer $$$T$$$ indicating the number of test cases. For each test case:
The first line contains an integer $$$n$$$ ($$$1 \le n \le 4 \times 10^5$$$) indicating the length of the sequence.
The second line contains $$$n$$$ integers $$$a_1, a_2, \cdots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) indicating the sequence.
It's guaranteed that the sum of $$$n$$$ of all test cases does not exceed $$$4 \times 10^5$$$.
Let $$$c_i$$$ be the number of good subarrays when $$$k = i$$$. To decrease the size of output, for each test case, just output one line containing one integer indicating $$$\sum\limits_{i = 1}^n (i \times c_i^2)$$$ modulo $$$998244353$$$.
3111 1 2 1 2 2 3 3 2 3 132024 5 2631000000000 1000000000 1000000000
2564 36 20
We denote $$$[l, r]$$$ as the continuous subarray $$$a_l, a_{l + 1}, \cdots, a_r$$$. For the first sample test case: