#include int n; int T; const int R = 1e9 + 7; int A[200000]; char str[200000]; long long two[200000]; long long gcd(long long a, long long b, long long &x, long long &y) { if (b == 0) { x = 1; y = 0; return a; } long long x0, y0; long long res = gcd(b, a % b, x0, y0); x = y0; y = x0 - (a / b) * y0; return res; } long long inv(long long k) { long long x, y; gcd(k, R, x, y); while (x < 0) x += R; return x; } void shift(int a, int b, int c) { for (int i = a; i <= b; ++i) { A[T + i] += c; A[T + i] %= 26; } } void print(int a, int b) { int cnt['z' - 'a' + 1] = { 0 }; for (int i = a; i <= b; ++i) { ++cnt[A[T + i]]; } long long x = 1, y = 1; for (int i = 0; i < 26; ++i) { if (!cnt[i]) continue; x *= two[cnt[i] - 1]; x %= R; y += cnt[i] * inv(two[cnt[i] - 1]); y %= R; } long long res = x * y + R - 1; printf("%lld\n", res % R); } int main() { two[0] = 1; for (int i = 1; i <= 100000; ++i) two[i] = (2 * two[i - 1]) % R; int q; scanf("%d %d", &n, &q); scanf("%s", str); for (T = 1; T <= n; T *= 2); for (int i = 0; i < n; ++i) { A[T + i] = str[i] - 'a'; } while (q--) { int t, a, b, c; scanf("%d", &t); if(t == 2) scanf("%d %d", &a, &b); else scanf("%d %d %d", &a, &b, &c); if (t == 1) shift(a, b, c); else print(a, b); } return 0; }