let n integer consider permutation integer 1 n lexicographic order concatenate big sequence p for example n 3 p 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 the length sequence n cdot nLet 1 leq leq j leq n cdot n pair index we sequence p_i p_i1 dot p_j1 p_j subarray p its length define number element ie j 1 its sum sum element ie sum_kij p_k you give n find number subarray p length n have sum fracnn12 since number large output modulo 998244353 prime number