#include using namespace std; #define ll long long #define pb push_back #define fr first #define sc second #define ARRS int(2e6+11) #define MAX ((long long)(1e18)) #define HS1 ((long long)(1000001329)) #define HS2 ((long long)(1000001531)) #define MOD ((long long)1000000007) #define MC ((long long)26) ll i,j,l,k,n,m,p,c,d,mx,mn,x,y,ans,res,sum; ll fx[ARRS]; ll sf[ARRS]; //string s,s1,s2; //vector v[ARRS]; double tx,ty; struct node{ node *L,*R; ll x[27]; ll shval,shep; node(){ shep=0; shval=0; for(int i=0; i<26; i++) x[i]=0; //x=0; L=NULL; R=NULL; } void updt(){ shval=0; for(int i=0; i<26; i++){ x[i]=0; if(L!=NULL) x[i]+=L->x[((i-L->shval)%MC+MC)%MC]; if(R!=NULL) x[i]+=R->x[((i-R->shval)%MC+MC)%MC]; } } void shplit(){ if(!L)L=new node(); if(!R)R=new node(); L->shval=(L->shval+shval)%MC; R->shval=(R->shval+shval)%MC; ll ox[27]; for(int i=0; i<26; i++)ox[i]=x[i]; for(int i=0; i<26; i++){ x[i]=ox[((i-shval)%MC+MC)%MC]; } shval=0; } }; ll wi,wx; void upp(ll l,ll r,node *& x){ if(!x)x=new node(); if(r-1x[wx]=1;return;} upp(l,(l+r)/2,x->L); upp((l+r)/2,r,x->R); x->updt(); } ll wl,wr; void update(ll l,ll r,node *& x){ if(wrshval=(x->shval+wx)%MC; return; } if(x->shval)x->shplit(); update(l,(l+r)/2,x->L); update((l+r)/2,r,x->R); x->updt(); } ll sm[27]; void summ(ll l,ll r,node *& x){ if(wrx[((i-x->shval)%MC+MC)%MC]; } return; } if(x->shval)x->shplit(); summ(l,(l+r)/2,x->L); summ((l+r)/2,r,x->R); } string s; node * root; ll f[ARRS]; int main(){ #ifdef KHOKHO freopen("in.in","r",stdin); freopen("out.out","w+",stdout); #endif //KHOKHO //cout<>n>>m; cin>>s; for(int i=0; i>q; if(q==1){ cin>>wl>>wr>>wx; update(0,n+1,root); } else { memset(sm,0,sizeof(sm)); cin>>wl>>wr; summ(0,n+1,root); // cout<