#include #include #define int long long int using namespace std; const int MAX = 510; const int MOD = 1e9 + 7; int N, Q; int c[27]; int dp[27][2]; int powerr(int base, int exp){ if(!exp) return 1; if(exp & 1) return (base * powerr(base, exp - 1)) % MOD; else return powerr(base*base, exp >> 1); } int rec(int pos, int ch){ if(!pos) return 1; if(dp[pos][ch] != -1) return dp[pos][ch]; if(c[pos]){ int ans = 0; if(c[pos] & 1){ ans = ans + ((rec(pos-1, ch)) * powerr(2, c[pos] - 1)) % MOD; ans %= MOD; if(ch == 0) ans = (ans + ((rec(pos-1, 1)) * powerr(2, c[pos] - 1)) % MOD) % MOD; } else{ ans = (ans + ((rec(pos-1, ch)) *powerr(2, c[pos] - 1)) % MOD) % MOD; if(ch == 0) ans = (ans + ((rec(pos-1, 1)) * powerr(2, c[pos] - 1)) % MOD) % MOD; } return dp[pos][ch] = ans; } else return dp[pos][ch] = rec(pos-1, ch); } signed main(){ cin >> N >> Q; string s; cin >> s; s = ' ' + s; while(Q--){ int ty, l, r; cin >> ty >> l >> r; ++l; ++r; if(ty == 1){ int t; cin >> t; t %= 26; for(int i=l; i<=r; ++i){ s[i] -= 'a'; s[i] += t; s[i] %= 26; s[i] += 'a'; } } else{ memset(c, 0, sizeof c); memset(dp, -1, sizeof dp); for(int i=l; i<=r; ++i){ ++c[s[i] - 'a' + 1]; } // for(int i=0; i<=26; ++i) cout << i << ' ' << c[i] << endl; cout << rec(26, 0) - 1 << endl; } } }