Let n be an integer. Consider all permutations on integers 1 to n in lexicographic order, and concatenate them into one big sequence p. For example, if n=3, then p=[1,2,3,1,3,2,2,1,3,2,3,1,3,1,2,3,2,1] . You are given n. Find the number of subarrays of p of length n having sum n(n+1)2. Since this number may be large, output it modulo 998244353 problem link

I tried to understand it form editorial but I m not able to get the last part which I have marked with rectangle