#include using namespace std; #define M 1000000007 typedef long long LL; const int N = 100005; int a[N]; int lazy[4*N]; int tree[26][4*N]; char s[N]; void build(int tl, int tr, int node){ if(tl==tr) { tree[s[tl]-'a'][node]++; return; } int mid = (tl+tr)/2; build(tl, mid, node*2); build(mid+1, tr, node*2+1); for(int i = 0; i < 26; i++) tree[i][node] = tree[i][node*2] + tree[i][node*2+1]; } void update(int tl, int tr, int l, int r, int val, int node) { if(lazy[node]!=0) { int v[26]; lazy[node]%=26; for(int i = 0; i < 26; i++) v[i] = tree[i][node]; for(int i = 0; i < 26; i++) tree[(i+lazy[node])%26][node] = v[i]; if(tl!=tr) { lazy[node*2] += lazy[node]; lazy[node*2+1] += lazy[node]; } lazy[node] = 0; return; } if(tl > tr || tl > r || l > tr) return; int mid = (tl+tr)>>1; if(tl >= l && tr <= r) { int v[26]; for(int i = 0; i < 26; i++) v[i] = tree[i][node]; for(int i = 0; i < 26; i++) tree[(i+val)%26][node] = v[i]; if(tl!=tr) { lazy[node*2] += val; lazy[node*2+1] += val; } return; } update(tl, mid, l, r, val, node*2); update(mid+1, tr, l, r, val, node*2+1); for(int i = 0; i < 26; i++) tree[i][node] = tree[i][node*2] + tree[i][node*2+1]; } inline LL power(LL x,LL y) { LL ans=1; while(y>0){ if(y&1) ans=(ans*x)%M; x=(x*x)%M; y/=2; } return ans; } int ret[26]; void query(int tl, int tr, int l, int r, int node) { if(tl > tr || tl > r || l > tr) return; if(lazy[node]!=0) { int v[26]; lazy[node]%=26; for(int i = 0; i < 26; i++) v[i] = tree[i][node]; for(int i = 0; i < 26; i++) tree[(i+lazy[node])%26][node] = v[i]; if(tl!=tr) { lazy[node*2] += lazy[node]; lazy[node*2+1] += lazy[node]; } lazy[node] = 0; return; } int mid = (tl+tr)>>1; if(tl >= l && tr <= r) { for(int i = 0; i < 26; i++) ret[i] += tree[i][node]; return; } query(tl, mid, l, r, node*2); query(mid+1, tr, l, r, node*2+1); } int main() { int n, q; scanf("%d %d",&n, &q); scanf("%s", s+1); build(1, n, 1); while(q--) { int id, l, r; scanf("%d %d %d", &id, &l, &r); l++, r++; int t; if(id == 1) { scanf("%d", &t); update(1, n, l, r, t, 1); } else { memset(ret, 0, sizeof ret); query(1, n, l, r, 1); LL ans = 0; LL val = 1; LL c = 0; for(int i = 0; i < 26; i++) { if(ret[i]==0) continue; c++; val = (val*power(2, ret[i]-1))%M; } // printf("%lld\n",val); ans = (val * (c+1))%M; ans = (ans - 1 + M)%M; printf("%lld\n",ans); } } return 0; }