#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 vector op(vector a,vector b){ return convolution(a,b); } vector e(){ return {1}; } int main(){ int n; cin>>n; vector> p(n); rep(i,n){ int t; cin>>t; p[i] = {1,t}; } segtree,op,e> seg(p);//0; int q; cin>>q; rep(_,q){ int a,b,k; cin>>a>>b>>k; auto r = seg.prod(a-1,b); cout<