You are given an array a1,a2,…,an.
You perform the following operation exactly k times.
Choose two integers l and r uniformly at random among all pairs satisfying 1≤l≤r≤n, then reverse the subarray al,al+1,…,ar.
The operations are independent.
The beauty of an array b is defined as
1≤x<y≤n∑max(0,bx−by).
Compute the expected value of the beauty of the final array modulo 998244353.
Formally, if the expected value can be written as an irreducible fraction qp, output p×q−1 modulo 998244353.