#include using namespace std; const int mod = 1e9 + 7; int n, q, t, x, y, c; int dp[511][511]; string s; int rec( int i, int j ) { if( i > j ) return 0; int &ret = dp[i][j]; if( ~ret ) return ret; if( i == j ) return ret = 1; if( i+1 == j ) return ret = 2 + ( s[i] == s[j] ); ret = rec( i+1, j ) + rec( i, j-1 ) - rec( i+1, j-1 ) + ( s[i] == s[j] ) * ( rec( i+1, j-1 ) + 1 ); return ret %= mod; } int main() { int cc; cin >> n >> q >> s; memset( dp, -1, sizeof dp ); while( q-- ) { cin >> t; if( t == 1 ) cin >> x >> y >> c; else cin >> x >> y; if( t == 1 ) { c %= 26; for( int i=x; i<=y; i++ ) { s[i] += c; cc = s[i] - 'z'; if( cc > 0 ) s[i] = 'a' + cc; } memset( dp, -1, sizeof dp ); } else { cout << rec( x, y ) << "\n"; } } return 0; }