#include using namespace std; typedef long long ll; typedef vector vi; typedef vector vb; typedef vector vvi; typedef vector vll; typedef vector vvll; typedef vector vvb; typedef pair pii; typedef vector vpii; typedef vector vvpii; typedef set si; typedef map mii; typedef priority_queue pqi; typedef priority_queue pqpii; #define fir first #define sec second #define pb push_back #define mp make_pair #define sz(x) x.size() #define rep(i,n) for(int i=0;ib;i--) #define tr(it,x) for(it=x.begin();it!=x.end();it++) #define rtr(it,x) for(it=x.rbegin();it!=x.rend();it++) #define fast_io ios_base::sync_with_stdio(0); #define accuracy int precision = numeric_limits::digits10; const ll pri = pow(10,9)+7; ll myPow(ll a,ll b) { if(b == 0) return 1; else if(b % 2 == 0) { ll temp = myPow(a,b/2); temp *= temp;temp %= pri; return temp; } else { ll temp = myPow(a,(b-1)/2); temp *= temp;temp %= pri;temp *= a;temp %= pri; return temp; } } int main() { fast_io; accuracy; int n,q; cin >> n >> q; string s; cin >> s; rep(i,q) { int temp; cin >> temp; if(temp == 1) { int p,q,t; cin >> p >> q >> t; t %= 26; fo(k,p,q+1) { int z = s[k]-'a'; z += t; z %= 26; s[k] = 'a'+z; } } else { int p,q; cin >> p >> q; map x; fo(k,p,q+1) { if(x.count(s[k]) == 0) x[s[k]] = 1; else x[s[k]]++; } ll ans1 = 1,ans2 = 0; map::iterator it; bool valid1 = false; vi val; tr(it,x) { val.pb(it->sec); if(it->sec >= 2) { valid1 = true; } if(valid1 and it->sec >= 2) { ans1 *= myPow(2,(ll) it->sec-1); ans1 %= pri; } } if(!valid1) ans1 = 0; else ans1 = (ans1-1+pri)%pri; int c = 0; tr(it,x) { ll temp = 1; rep(z,sz(val)) { if(z != c) { if(val[z] >= 2) { temp *= myPow(2,(ll) val[z]-1); temp %= pri; } } else { if(val[z] >= 2) { temp *= myPow(2,(ll) val[z]-1); temp %= pri; } } } c++; ans2 += temp; ans2 %= pri; } // cout << "check " << ans1 << " " << ans2 << endl; cout << (ans1+ans2)%pri << endl; } } }