#include using namespace std; typedef long long ll; typedef double ld; typedef pair pl; #define sl(x) scanf("%d",&x) #define pl(x) printf("%lld\n",x) #define sf(x) sort(x.begin(),x.end(),func) #define s(x) sort(x.begin(),x.end()) #define all(v) v.begin(),v.end() #define rs(v) { s(v) ; r(v) ; } #define r(v) {reverse(all(v));} #define pb push_back #define mp make_pair #define F first #define S second #define f(i,n) for(int i=0;i= m) a -= m; if(a < 0) a += m; return a;} ll power(ll a, ll b, ll m = mod) { if(b == 0) return 1; if(b == 1) return (a % m); ll x = power(a, b / 2, m); x = mul(x, x, m); if(b % 2) x = mul(x, a, m); return x;} ll n, q, st[N * 4][27], lazy[N * 4]; string a; void push(ll id, ll s, ll e) { if(!lazy[id]) return ; ll ne[26] = {}; f(i, 26) { ll ni = (i + lazy[id]) % 26; ne[ni] = st[id][i]; } f(i, 26) { st[id][i] = ne[i]; } if(s != e) { lazy[id * 2] = (lazy[id * 2] + lazy[id]) % 26; lazy[id * 2 + 1] = (lazy[id * 2 + 1] + lazy[id]) % 26; } lazy[id] = 0; } void build(ll id, ll s, ll e) { if(s == e) { ll x = (ll)(a[s] - 'a'); st[id][x] = 1; return; } ll m = (s + e) >> 1; build(id * 2, s, m); build(id * 2 + 1, m + 1, e); f(i, 26) st[id][i] = st[id * 2][i] + st[id * 2 + 1][i]; } void update(ll id, ll s, ll e, ll l, ll r, ll t) { push(id, s, e); if(s > e || s > r || l > e) return ; if(l <= s && e <= r) { lazy[id] = (lazy[id] + t) % 26; push(id, s, e); return ; } ll m = (s + e) >> 1; update(id * 2, s, m, l, r, t); update(id * 2, m + 1, e, l, r, t); f(i, 26) st[id][i] = st[id * 2][i] + st[id * 2 + 1][i]; } ll query(ll id, ll s, ll e, ll l, ll r, ll c) { push(id, s, e); if(s > e || s > r || l > e) return 0; if(l <= s && e <= r) { return st[id][c]; } ll m = (s + e) >> 1; return (query(id * 2, s, m, l, r, c) + query(id * 2 + 1, m + 1, e, l, r, c)); } ll p[N], ip[N]; int main() { ios_base::sync_with_stdio(0); cin >> n >> q; cin >> a; p[0] = 1; for(ll i = 1; i <= n; i++) p[i] = mul(p[i - 1], 2ll); ip[n] = power(p[n], mod - 2); for(ll i = n - 1; i >= 0; i--) ip[i] = mul(ip[i + 1], 2ll); build(1, 0, n - 1); f(i, q) { ll t; cin >> t; if(t == 1) { ll l, r, t; cin >> l >> r >> t; update(1, 0, n - 1, l, r, t); } else { ll l, r; cin >> l >> r; ll c[26] = {}; ll x[26] = {}; ll e = 1; f(j, 26) { ll f = query(1, 0, n - 1, l, r, j); if(f == 0) { c[j] = -1; continue; } c[j] = p[f - 1]; x[j] = ip[f - 1]; e = mul(e, c[j]); } ll ne = add(e, -1); ll o = 0; f(j, 26) { if(c[j] == -1) continue; ll xx = mul(e, x[j]); xx = mul(xx, c[j]); o = add(o, xx); } o = add(o, ne); cout << o << "\n"; } } return 0; }