#include #include #include #include #define M 1000000007 void update(char *s, int i, int j, int t){ int l; for(l = i; l <= j; l++){ if (s[i] + t > 'z') s[i] = (s[i] + t) % 'z' + 'a' - 1; else s[i] = s[i] + t; } } long long ipow(int x, unsigned int y){ if (y == 0) return 1; else if (y % 2 == 0) return (ipow(x, y / 2) * ipow(x, y / 2)) % M; else return (x * ipow(x, y / 2) * ipow(x, y / 2)) % M; } int main(){ int n; int q; scanf("%d%d", &n, &q); char s[10001]; scanf("%s", s); int a0; for(a0 = 0; a0 < q; a0++){ // your code goes here int command, i, j, t, l; scanf("%d", &command); switch(command){ case 1: scanf("%d%d%d", &i, &j, &t); update(s, i, j, t); break; case 2: scanf("%d%d", &i, &j); long long *c = (long long *)calloc(sizeof(long long), 201); for(l = i; l <= j; l++){ c[s[l]]++; } long long c1 = 0, c2 = 0; for(l = 'a'; l <= 'z'; l++){ if (c[l] % 2) c2 += c[l]; else c1 += c[l]; } printf("%lld\n", (long long)((long long)ipow(2, c1) * (c2 + 1)) % M - (c1 + 1)); break; } } return 0; }