#include #include using namespace std; using namespace atcoder; using ll = long long; using ull = unsigned long long; using ld = long double; using mint = modint998244353; ll vsize = 32; struct S{ vector value; int size; }; struct F{ ll ch; ll sq; }; const F ID = {-1,0}; S op(S a, S b){ vector c(vsize,1); for(ll i = 0; i < vsize; i++){ c[i] = a.value[i] + b.value[i]; } return {c, a.size+b.size}; } S e(){ return {vector(vsize,0),0}; } S mapping(F f, S x){ if(f.ch != -1){ x.value[0] = f.ch; for(ll i = 1; i < vsize; i++){ x.value[i] = sqrtl(x.value[i-1]); } } for(ll i = 0; i < vsize; i++){ if(i + f.sq < vsize){ x.value[i] = x.value[i + f.sq]; }else{ x.value[i] = x.size; } } return x; } F composition(F f, F g){ F ret; if(f.ch != -1)ret = f; else ret = {g.ch, f.sq + g.sq}; return ret; } F id(){ return ID; } int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n,q; cin >> n >> q; vector a(n,0); lazy_segtree seg(n); vector vec(vsize,1); for(ll i = 0; i < n; i++){ cin >> a[i]; vec[0] = a[i]; for(ll t = 1; t < vsize; t++){ vec[t] = sqrtl(vec[t-1]); } seg.set(i,{vec,1}); } ll que,l,r,x; while(q--){ cin >> que >> l >> r; if(que == 0){ cout << seg.prod(l,r).value[0] << '\n'; }else if(que == 1){ cin >> x; seg.apply(l,r,{x,0}); }else{ seg.apply(l,r,{-1,1}); } } }