#include using namespace std; #define mem(x,y) memset(x,y,sizeof(x)) #define bitcount __builtin_popcountll #define mod 1000000007 #define N 1000009 #define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define ss(s) cin>>s; #define si(x) scanf("%d",&x); #define sl(x) cin>>x; #define pb push_back #define mp make_pair #define all(v) v.begin(),v.end() #define S second #define F first #define ll long long //#define TRACE #ifdef TRACE #define trace1(x) cerr << #x << ": " << x << endl; #define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl; #define trace3(x, y, z) cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl; #define trace4(a, b, c, d) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl; #define trace5(a, b, c, d, e) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl; #define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl; #else #define trace1(x) #define trace2(x, y) #define trace3(x, y, z) #define trace4(a, b, c, d) #define trace5(a, b, c, d, e) #define trace6(a, b, c, d, e, f) #endif ll power(ll a,ll b) {ll res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} string a,c,s; int q,n,ai,b; int arr[100005][27]; int brr[N]; int t[26][400006]; int lazy[100006]; //ll arr[N]; void build(int node,int a,int b){lazy[node]=0; if(a==b){ t[s[a]-'a'][node]++; //lazy initialization return; } int mid=(a+b)/2; build(2*node,a,mid); build(2*node+1,mid+1,b); for(int i=0;i<26;i++) t[i][node] = t[i][node + node] + t[i][node + node +1]; //t[node]=merge(node*2,node*2+1); return; } int tem[27]; void push(int node,int a,int b){ for(int i=0;i<26;i++)tem[i]=t[i][node]; for(int i=0;i<26;i++)t[i][node]=0; for(int i=0;i<26;i++)t[(i + lazy[node])%26][node]+=tem[i]; mem(tem,0); if(a!=b){ lazy[2*node]=(lazy[node*2]+lazy[node])%26; lazy[2*node+1]=(lazy[2*node+1]+lazy[node])%26; } lazy[node]=0; } void update(int node,int a,int b,int l,int r,int x){ //update(1,1,n,l,r) if(lazy[node]!=0){ //be careful on x's datatype push(node,a,b); } if(b>n>>q; cin>>s; string a =s; s = "?"+s; build(1,1,n); if(q<500){ while(q--){ int type; cin>>type>>ai>>b; if(type==1){ai++; b++; int va; cin>>va; va%=26; update(1,1,n,ai,b,va); } else{ b++; ai++; int co[27]; mem(co,0); ll as1=1; ll c1=0; for(int i=0;i<26;i++)co[i] = query(1,1,n,ai,b,i); //if(ai)for(int i=0;i<26;i++)co[i]-=arr[ai-1][i]; for(int i=0;i<26;i++) { ll x=co[i]; if(x>0) { as1=(as1*power(2,x-1))%mod; c1++; } } ll ans=(c1*as1)%mod; ans=(ans+as1)%mod; ans=(ans+mod - 1)%mod; cout<>type>>ai>>b; int co[27]; mem(co,0); ll as1=1; ll c1=0; for(int i=0;i<26;i++)co[i]+=arr[b][i]; if(ai)for(int i=0;i<26;i++)co[i]-=arr[ai-1][i]; for(int i=0;i<26;i++) { ll x=co[i]; if(x>0) { as1=(as1*power(2,x-1))%mod; c1++; } } ll ans=(c1*as1)%mod; ans=(ans+as1)%mod; ans=(ans-1+mod)%mod; cout<