#!/bin/python from collections import * MD=10**9+7 def Pal(a): #print "arg: ",a for i in a: if i>1: break else: return sum(a) b=a[:] for i in xrange(len(b)): if b[i]>1: b[i]-=2 tmp=(b[i]+1)*(b[i]+2)/2 return (sum(b)+2+tmp*(Pal(b)+1))%MD n,q = raw_input().strip().split(' ') n,q = [int(n),int(q)] s = raw_input().strip() for a0 in xrange(q): qr=map(int,raw_input().strip().split(' ')) beg=qr[1] end=qr[2] if qr[0]==1: t=qr[3]%26 new_s=[s[i] for i in xrange(len(s))] for i in xrange(beg,end+1): new_s[i]=chr((ord(s[i])-ord('a')+t)%26+ord('a')) s="".join(new_s) #print s else: ss=Counter([s[i] for i in xrange(beg,end+1)]) ind=[ss[k] for k in ss] print Pal(ind)