#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define forn(i, n) for(int i = 0; i < (int) (n); i++) #define M 1000000007 int c[100100][26]; long long calc(long long x) { if(x <= 0) return 1; long long b = calc(x / 2); if(x % 2) return (2 * b * b) % M; return (b * b) % M; } int main(){ int n; int q; cin >> n >> q; string s; cin >> s; forn(i, n) { forn(j, 26) c[i + 1][j] = c[i][j]; c[i + 1][s[i] - 'a'] ++; } for(int a0 = 0; a0 < q; a0++){ int u; cin >> u; if(u == 1) { int ii, jj, t; cin >> ii >> jj >> t; for(int k = ii; k <= jj; k ++) s[k] = 'a' + (s[k] - 'a' + t) % 26; forn(i, n) { forn(j, 26) c[i + 1][j] = c[i][j]; c[i + 1][s[i] - 'a'] ++; } } else { int i, j; cin >> i >> j; long long r = 1; int b = 1; forn(k, 26) { r = (r * calc(c[j + 1][k] - c[i][k] - 1)) % M; if(c[j + 1][k] > c[i][k]) b++; } r = (r * b) % M; cout << (r + M - 1) % M << endl; } } return 0; }