import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static long numPalindromes(int[] array, int i, int j){ long sum = 0; if(i > j){ return 0; } else if(i == j){ return 1; } else{ if(array[i] == array[j]){ sum = 1 + numPalindromes(array, i+1, j-1); sum %= 1000000007L; } sum += numPalindromes(array, i, j-1); sum %= 1000000007L; sum += numPalindromes(array, i+1, j); sum %= 1000000007L; sum -= numPalindromes(array, i+1, j-1); } return sum; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int q = in.nextInt(); String s = in.next(); int[] sChars = new int[s.length()]; for(int i = 0; i < s.length(); i++){ sChars[i] = (int)s.charAt(i) - 97; } in.nextLine(); for(int a0 = 0; a0 < q; a0++){ String nextQuery = in.nextLine(); if(nextQuery.charAt(0) == '1'){ nextQuery = nextQuery.substring(nextQuery.indexOf(' ') + 1); int i = Integer.parseInt(nextQuery.substring(0, nextQuery.indexOf(' '))); nextQuery = nextQuery.substring(nextQuery.indexOf(' ') + 1); int j = Integer.parseInt(nextQuery.substring(0, nextQuery.indexOf(' '))); nextQuery = nextQuery.substring(nextQuery.indexOf(' ') + 1); int shift = Integer.parseInt(nextQuery); for(int index = i; index <= j; index++){ sChars[index] = (sChars[index] + shift) % 26; } } else{ nextQuery = nextQuery.substring(nextQuery.indexOf(' ') + 1); int i = Integer.parseInt(nextQuery.substring(0, nextQuery.indexOf(' '))); nextQuery = nextQuery.substring(nextQuery.indexOf(' ') + 1); int j = Integer.parseInt(nextQuery); System.out.println(numPalindromes(sChars, i, j)); } } } }