#include using namespace std; #define pb push_back #define mp make_pair typedef long long ll; typedef pair pii; const int MOD = 1e9 + 7; const int MAXN = 100005; int n, q; string s; int two[MAXN]; int cnt[26]; void add(int &x, int y) { x += y; if (x >= MOD) x -= MOD; } int mult(int x, int y) { return x * 1ll * y % MOD; } int main() { #ifdef LOCAL freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif ios_base::sync_with_stdio(false); cin.tie(0); two[0] = 1; for (int i = 1; i < MAXN; ++i) { two[i] = two[i - 1] * 2 % MOD; } cin >> n >> q; cin >> s; for (int tc = 1; tc <= q; ++tc) { int c, l, r; cin >> c >> l >> r; ++r; if (c == 1) { int shift; cin >> shift; shift %= 26; for (int i = l; i < r; ++i) { s[i] = (s[i] - 'a' + shift) % 26 + 'a'; } } else { memset(cnt, 0, sizeof cnt); for (int i = l; i < r; ++i) { ++cnt[s[i] - 'a']; } int res = 1; int x = 1; for (int i = 0; i < 26; ++i) { if (cnt[i]) { res = mult(res, two[cnt[i] - 1]); ++x; } } res = mult(res, x); if (--res < 0) res += MOD; cout << res << '\n'; } } return 0; }