(代码来自机房大佬lyj)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 100000+200;
ll p[4]={2,3,5,7};
class tree
{
public:
ll l,r,val[4];
} tree[maxn<<2];
ll num[maxn];
void build(int rt,int l,int r)
{
tree[rt].l=l;
tree[rt].r=r;
if(l==r)
{
ll now = num[l];
for(int i=0;i<4;i++)
{
if(now%p[i]==0)
{
int cnt = 0;
while(now%p[i]==0)
{
now/=p[i];
cnt++;
}
tree[rt].val[i]=cnt;
}
}
return ;
}
int mid=(l+r)>>1;
build(rt<<1,l,mid);
build(rt<<1|1,mid+1,r);
for(int i=0;i<4;i++)
tree[rt].val[i]=tree[rt<<1].val[i]+tree[rt<<1|1].val[i];
}
void update(int rt,int x,int z)
{
if(tree[rt].l == tree[rt].r && tree[rt].l==x)
{
ll now = z;
for(int i=0;i<4;i++) tree[rt].val[i]=0;
for(int i=0;i<4;i++)
{
if(now%p[i]==0)
{
int cnt = 0;
while(now%p[i]==0)
{
now/=p[i];
cnt++;
}
tree[rt].val[i]=cnt;
}
}
return ;
}
int mid=(tree[rt].r+tree[rt].l)>>1;
if(x<=mid)
{
update(rt<<1,x,z);
}
else
{
update(rt<<1|1,x,z);
}
for(int i=0;i<4;i++)
tree[rt].val[i]=tree[rt<<1].val[i]+tree[rt<<1|1].val[i];
}
ll Query(int rt,int x,int y,int id)
{
if(tree[rt].l>=x&&tree[rt].r<=y)
{
return tree[rt].val[id];
}
int mid=(tree[rt].l+tree[rt].r)>>1;
ll ans=0;
if(x<=mid)
{
ans+=Query(rt<<1,x,y,id);
}
if(y>mid)
{
ans+=Query(rt<<1|1,x,y,id);
}
return ans;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,m;
cin>>n>>m;
for(int i=1; i<=n; i++)
{
cin>>num[i];
}
build(1,1,n);
while(m--)
{
int f,x,y,z;
cin>>f;
if(f==1)
{
cin>>x>>z;
update(1,x,z);
}
else
{
cin>>x>>y;
ll ans = 1;
for(int i=0;i<4;i++)
{
// cout<<p[i]<<" "<<Query(1,x,y,i)+1<<endl;
ans*=(Query(1,x,y,i)+1);
ans%=998244353;
}
cout<<ans%998244353<<"\n";
}
}
}