import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long mod = 1000000007; static long[] powers = new long[100001]; static { powers[0] = 1; for (int i = 1; i < powers.length; i++) { powers[i] = (2 * powers[i - 1]) % mod; } } static void shift(char[] s, int i, int j, int t) { t = t % 26; for (int p = i; p <= j; p++) { int ci = (int)(s[p] - 'a'); ci = (ci + t) % 26; s[p] = (char)('a' + ci); } } static void solve2(char[] s, int i, int j) { // if(s.length > 500) return; int[] dist = new int[26]; for (int k = i;k <= j; k++) { int ci = (int)(s[k] - 'a'); dist[ci]++; } long result = 0; long prod = 1; int non0 = 0; for (int k = 0; k < dist.length; k++) { if(dist[k] == 0) continue; non0++; prod = (prod * powers[dist[k] - 1]) % mod; } result = (prod * non0) % mod; prod = (prod + mod - 1) % mod; result = (result + prod) % mod; System.out.println(result); } static void run() { Scanner in = new Scanner(System.in); int n = in.nextInt(); int q = in.nextInt(); String s = in.next(); char[] cs = s.toCharArray(); for(int a0 = 0; a0 < q; a0++){ int kind = in.nextInt(); int i = in.nextInt(); int j = in.nextInt(); if(kind == 1) { int t = in.nextInt(); shift(cs, i, j, t); } else { solve2(cs, i, j); } } in.close(); } public static void main(String[] args) { // Scanner in = new Scanner(System.in); // int n = in.nextInt(); // int q = in.nextInt(); // String s = in.next(); // for(int a0 = 0; a0 < q; a0++){ // your code goes here // } run(); } }