#include using namespace std; int main(){ //freopen("in","r",stdin); int n; int q; int i,j,x,y,t,a[150],cnt,sum; cin >> n >> q; string s; cin >> s; for(int a0 = 0; a0 < q; a0++){ // your code goes here sum=0; scanf("%d",&n); if(n==1) { scanf("%d %d %d",&x,&y,&t); for(i=x;i<=y;i++) { s[i]=((t%26)+s[i]-'a')%26+'a'; } } else { memset(a,0,sizeof(a)); scanf("%d %d",&x,&y); sum=0; for(i=x;i<=y;i++) { a[s[i]]++; } for(i='a';i<='z';i++) { sum+=(a[i]*(a[i]+1)/2); cnt=0; if(a[i]!=0 && a[i]%2==0) { cnt=1; for(j='a';j<='z';j++) { if(a[j]%2==0 && a[j]) { cnt*=a[j]/2; } else if(a[j]) cnt*=a[j]; } sum+=cnt; // cout<