/* * Code Author: Akshay Miterani * DA-IICT */ import java.io.*; import java.math.BigInteger; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.*; public class MainA { static double eps=(double)1e-6; static long mod=(long)1e9+7; static final long INF = Long.MAX_VALUE / 100; public static void main(String args[]) throws FileNotFoundException{ InputReader in = new InputReader(System.in); OutputStream outputStream = System.out; PrintWriter out = new PrintWriter(outputStream); //----------------My Code------------------ int n=in.nextInt(); int q=in.nextInt(); char c[]=in.nextLine().toCharArray(); while(q-->0){ int type=in.nextInt(); if(type==1){ int s=in.nextInt(); int e=in.nextInt(); int t=in.nextInt(); for(int i=s;i<=e;i++){ c[i]++; if(c[i]>'z') c[i]='a'; } } else{ int s=in.nextInt(); int e=in.nextInt(); int count[]=new int[26]; for(int i=s;i<=e;i++){ count[c[i]-'a']++; } long ans=1; for(int i=0;i<26;i++){ ans*=modulo(2, count[i]/2, mod); ans%=mod; } long prev=ans; ans=0; for(int i=0;i<26;i++){ if(count[i]==0) continue; long t1=prev*modulo(modulo(2, count[i]/2, mod), mod-2, mod);t1%=mod; t1=(t1)*(modulo(2, count[i], mod)-1);t1%=mod; ans+=t1; ans%=mod; } out.println((ans+mod)%mod); } } out.close(); //----------------The End------------------ } static long modulo(long a,long b,long c) { long x=1; long y=a; while(b > 0){ if(b%2 == 1){ x=(x*y)%c; } y = (y*y)%c; // squaring the base b /= 2; } return x%c; } static class Pair implements Comparable{ int x; int y; Pair(int xx,int yy){ x=xx; y=yy; } @Override public int compareTo(Pair o) { if(Long.compare(this.x, o.x)!=0) return Long.compare(this.x, o.x); else return Long.compare(this.y, o.y); } } public static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } static class InputReader { public BufferedReader reader; public StringTokenizer tokenizer; public InputReader(InputStream inputstream) { reader = new BufferedReader(new InputStreamReader(inputstream)); tokenizer = null; } public String nextLine(){ String fullLine=null; while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { fullLine=reader.readLine(); } catch (IOException e) { throw new RuntimeException(e); } return fullLine; } return fullLine; } public String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) { try { tokenizer = new StringTokenizer(reader.readLine()); } catch (IOException e) { throw new RuntimeException(e); } } return tokenizer.nextToken(); } public long nextLong() { return Long.parseLong(next()); } public int nextInt() { return Integer.parseInt(next()); } } }