#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define mod 1000000007 using namespace std; int main(){ int on; int q; cin >> on >> q; string s; cin >> s; int l,r,choice,t; for(int a0 = 0; a0 < q; a0++){ cin>>choice; if(choice==1){ cin>>l>>r>>t; for(int i=l;i<=r;i++){ s[i]=(s[i]-'a'+t)%mod + 'a'; } } else{ cin>>l>>r; int n = r-l+1; string str = s.substr(l,r-l+1); int store[n+1][n+1]; for(int i=0;i<=n;i++) { for(int j=0;j<=n;j++) { if(i==j) { store[i][j] = 1; } else{ store[i][j] = 0; } } } for(int len=2;len<=n;len++) { for(int i=1;i<=n;i++) { int j=i+len-1; if(j>n) continue; if(str[i-1] == str[j-1]) { store[i][j] = store[i][j-1]+store[i+1][j]+1; } else { store[i][j] = store[i][j-1]+store[i+1][j]-store[i+1][j-1]; } } } cout << store[1][n]%mod << endl; } } return 0; }