There are N different types of items. The ith item has ci distinct copies. In this problem, you are going to deal with Q queries. The ith query is represented by three integers - li,ri,ki. For every query, you need to find the number of ways for choosing ki items of different types, and their types must be within the interval [li,ri] (inclusive). Since this number might be huge, you are only asked to print its remainder modulo 998244353.
Note that you can't choose two items of the same type i, i.e., if you want to choose an item of type i, you can do this in ci ways.
Input
The first line contains two integers - N and Q (1≤N,Q≤214).
The next line contains N integers - c1,c2,…,cN(1≤ci≤108).
The next Q lines contain three integers - ai,bi,ki (0≤ai,bi<N,1≤li≤ri≤N,1≤ki≤ri−li+1). If last is the answer for (i−1)th (at the beginning last=0) query then:
1.li=((ai+last)modN)+1
2.ri=((bi+last)modN)+1
For 25 points you can consider that N,Q≤1024.
For another 25 points you can consider that ki≤20.
For another 25 points you can consider that ki≤256.
Output
Output Q lines, the ith line constains the answer for the ith query in chronological order.
The queries are (l1,r1)=(2,4),(l2,r2)=(1,5),(l3,r3)=(4,5). The answer for the first query is 2⋅3+2⋅4+3⋅4=26.