#include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } struct S { mint a[3][3]; }; S e(){ S ret; rep(i,0,3){ rep(j,0,3){ if(i==j) ret.a[i][j] = 1; else ret.a[i][j] = 0; } } return ret; } S empt(){ S ret; rep(i,0,3){ rep(j,0,3){ ret.a[i][j] = 0; } } return ret; } S op(S a, S b){ S ret = empt(); rep(i,0,3){ rep(j,0,3){ rep(k,0,3){ ret.a[i][j] += a.a[i][k] * b.a[k][j]; } } } return ret; } ll opmax(ll a, ll b){ return std::max(a, b); } ll emax(){ return -(ll)8e18; } ll mapping(ll f, ll x){ return f+x; } ll composition(ll f, ll g){ return f+g; } ll id(){ return 0; } int main(){ S zero = e(); S one = e(); zero.a[0][1] = 1; zero.a[0][2] = 1; one.a[1][0] = 1; one.a[1][2] = 1; int n, q; cin >> n >> q; string s; cin >> s; segtree seg(n); rep(i,0,n){ if(s[i]=='0')seg.set(i,zero); else seg.set(i,one); } auto f = [&](ll a){ return a<=0; }; lazy_segtree laseg(vector(n,0)); while(q--){ int t; cin >> t; if (t == 1){ int l, r; cin >> l >> r; l--; laseg.apply(l,r,1); int piv=l; while(piv=r)break; seg.set(piv,e()); laseg.apply(piv,-1e9); } }else{ int l, r; cin >> l >> r; l--; S ret = seg.prod(l,r); cout << (ret.a[1][2]).val() << '\n'; } } }