#include<bits/stdc++.h>
#define int long long
using namespace std;
inline int read(){
int x = 0 ,f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') {
if(ch == '-')f = -1;
ch = getchar();
}
while(ch >= '0' && ch <= '9') {
x = (x << 3) + (x << 1) + (ch ^ 48);
ch = getchar();
}
return x * f;
}
const int N = 2e5 + 5;
int ans ,n ,m ,opt ,x ,y;
int tp[4 * N] ,a[N];
void pushdown(int p) {
tp[p * 2] += tp[p];
tp[p * 2 + 1] += tp[p];
return ;
}
void updata_sqrt(int l ,int r ,int s ,int t ,int p) {
if(l > t || r < s)return ;
if(l <= s && t <= r && s == t) {
if(tp[p] == 0) {
for(int i = s;i <= t;++ i) {
a[i] = sqrt(a[i]);
}
}
else -- tp[p];
return ;
}
int m = s + t >> 1;
pushdown(p);
updata_sqrt(l ,r ,s ,m ,p * 2);
updata_sqrt(l ,r ,m + 1 ,t ,p * 2 + 1);
return ;
}
void updata_power(int l ,int r ,int s ,int t ,int p) {
if(l > t || r < s)return ;
if(l <= s && t <= r && s == t) {
++ tp[p];
return ;
}
int m = s + t >> 1;
pushdown(p);
updata_power(l ,r ,s ,m ,p * 2);
updata_power(l ,r ,m + 1 ,t ,p * 2 + 1);
return ;
}
int power(int a ,int b) {
int ta = a ,tb = b % 998244352 ,anst = 1;
while(tb) {
if(tb % 2 == 1) {
anst = (anst * ta) % 998244353;
}
tb = tb / 2;
ta = (ta * ta) % 998244353;
}
return anst;
}
void query(int s ,int t ,int p) {
if(s == t) {
a[s] = power(a[s] ,power(2 ,tp[p]));
return ;
}
int m = s + t >> 1;
pushdown(p);
query(s ,m ,p * 2);
query(m + 1 ,t ,p * 2 + 1);
return ;
}
signed main() {
n = read();
m = read();
for(int i = 1;i <= n;++ i)
a[i] = read();
while(m --) {
opt = read();
x = read(); y = read();
if(opt == 1)
updata_sqrt(x ,y ,1 ,n ,1);
else
updata_power(x ,y ,1 ,n ,1);
}
query(1 ,n ,1);
for(int i = 1;i <= n;++ i) {
ans += a[i];
ans %= 998244353;
}
cout << ans;
return 0;
}