#include #include #include #include #include using namespace std; #define MOD int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n,q; cin>>n>>q; string s; cin>>s; while(q--) { int c,i,j; cin>>c>>i>>j; long long t; int freq[26] = {0}; long long ans = 0; switch(c) { case 1: cin>>t; t = t%26; for(int x = i; x<=j; x++) { s[x] = (s[x]-'a'+t)%26+'a'; } break; case 2: for(int x = i; x<=j; x++) { freq[s[x]-'a']++; } int f1 = 0; int f2 = 0; for(int x = 0; x<26; x++) { if(freq[x]==1) { f1++; } else if(freq[x]>1) { f2++; } } int gap = j-i+1; ans+=gap; for(int x = 2; x<=gap; x++) { if(x%2) { ans = ans + (f1*pow(f2,gap/2)); } else ans = ans + (pow(f2,gap/2)); } cout<