#include using namespace std; typedef long long ll; const ll mod = 1000000007; const int maxn = 100009; ll pow(ll a, int p) { ll ret = 1; while (p) { if (p % 2 == 1) { ret = (ret * a) % mod; } a = (a * a) % mod; p /= 2; } return ret; } int a[maxn]; ll C[2000][2000]; int main() { //freopen("input.txt", "r", stdin); for (int n = 0; n <= 600; n++) { C[n][0] = 1; //cout << C[n][0] << " "; for (int k = 1; k <= n; k++) { C[n][k] = (C[n - 1][k] + C[n - 1][k - 1]) % mod; //cout << C[n][k] << " "; } //cout << endl; } int n, q; cin >> n >> q; string s; cin >> s; for (int i = 0; i < n; i++) a[i] = int(s[i] - 'a'); while (q--) { int type, i, j; cin >> type >> i >> j; if (type == 1) { int t; cin >> t; for (int k = i; k <= j; k++) a[k] = (a[k] + t) % 26; } else { vector cnt(26, 0); for (int k = i; k <= j; k++) cnt[a[k]]++; ll ans = 1; for (int k = 0; k < 26; k++) { ll cur = 0; for (int b = 0; b <= cnt[k]; b += 2) cur = (cur + C[cnt[k]][b]) % mod; ans = (ans * cur) % mod; } ans--; for (int k = 0; k < 26; k++) { ll tmpans = 0; for (int b = 1; b <= cnt[k]; b += 2) tmpans = (tmpans + C[cnt[k]][b]) % mod; for (int kk = 0; kk < 26; kk++) { if (kk == k) continue; ll cur = 0; for (int b = 0; b <= cnt[kk]; b += 2) cur = (cur + C[cnt[kk]][b]) % mod; tmpans = (tmpans * cur) % mod; } ans = (ans + tmpans) % mod; } cout << ans << endl; } } }