#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; const int mod = 1000*1000*1000+7; long long exp(int a, int b){ if(b==0) return 1; long long z = exp(a,b/2); z = (z*z) % mod; if(b % 2 == 1){ z = (z*a) % mod; } return z; } const int maxn = 1000*100+100; int main(){ int n; int q; cin >> n >> q; string s; cin >> s; vector num; vector> count(maxn, vector(30,0)); for(int i=0;i0) for(int j=0;j<26;j++) count[i][j] = count[i-1][j]; count[i][s[i]-'a']++; } for(int a0 = 0; a0 < q; a0++){ int Q_Type; cin >> Q_Type; if(Q_Type == 1){ int i,j,t; cin >> i >> j >> t; for(int ind=i;ind<=j;ind++){ int next = (num[ind] + t) % 26; num[ind] = next; } } else { int i,j; cin >> i >> j; int c = 0; int sm = 0; vector count2(30,0); if(n * q < 1000*1000*10){ for(int ind=i;ind<=j;ind++) count2[num[ind]]++; } else{ for(int x=0;x<26;x++){ count2[x] = count[j][x]; if(i>0) count2[x] -= count[i-1][x]; } } for(int i=0;i<26;i++) if(count2[i]>0){ c++; sm += count2[i]; } long long ans = exp(2,sm-c); ans = ((c+1)*(ans)) % mod; cout << ans - 1 << endl; } } return 0; }