#include #define ll long long #define mod 1000000007 #define upperlimit 1000100 #define INF 1000000100 #define INFL 1000000000000000100 #define eps 1e-8 #define endl '\n' #define sd(n) scanf("%d",&n) #define slld(n) scanf("%lld",&n) #define pd(n) printf("%d",n) #define plld(n) printf("%lld",n) #define pds(n) printf("%d ",n) #define pllds(n) printf("%lld ",n) #define pdn(n) printf("%d\n",n) #define plldn(n) printf("%lld\n",n) #define REP(i,a,b) for(i=a;i<=b;i++) #define mp make_pair #define pb push_back #define pcc pair #define pii pair #define pll pair #define vi vector #define vl vector #define vii vector #define vll vector #define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++) #define F first #define S second using namespace std; ll gcd(ll n1,ll n2){ if(!n1)return n2; if(!n2)return n1; if(n1%n2==0)return n2; return gcd(n2,n1%n2); } ll powmod(ll base,ll exponent) { base%=mod; ll ans=1; while(exponent){ if(exponent&1)ans=(ans*base)%mod; base=(base*base)%mod; exponent/=2; } ans%=mod; return ans; } int cnt[26]; int cnt2[26][upperlimit+1]; int main() { int i,j,k,n,q,Q,l,r,t; sd(n); sd(q); string s; cin>>s; for(i=0;icnt2[i][l])k++; answer=((k+1)*powmod(2,r-l+1-k)-1)%mod; } plldn(answer); } } return 0; }