#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N=3005,P=1e9+7;

int fac[N],ifac[N];
int fpow(int a,int t){static int r;for(r=1;t;t>>=1,a=(ll)a*a%P)if(t&1)r=(ll)r*a%P;return r;}
int C(int n,int m){if(n<m)return 0;return (ll)fac[n]*ifac[m]%P*ifac[n-m]%P;}

int n,m,f[N],L,R,sum[N];
char str[N];

int main(){
	scanf("%d%d",&n,&m);
	scanf("%s",str+1);
	for(int i=1;i<=n;i++)sum[i]=sum[i-1]+(str[i]&1);
	fac[0]=1;
	for(int i=1;i<=n;i++)fac[i]=(ll)fac[i-1]*i%P;
	ifac[n]=fpow(fac[n],P-2);
	for(int i=n;i>=1;i--)ifac[i-1]=(ll)ifac[i]*i%P;
	f[0]=1;
	for(int i=1,l,r;i<=m;i++){
		scanf("%d%d",&l,&r);
		if(r<=R)continue;
		if(R<l){
			int t=0;
			for(int i=0;i<=n;i++)if(f[i])t=(t+(ll)C(R-L+1,i)*f[i])%P,f[i]=0;
			L=l,R=r,f[sum[R]-sum[L-1]]=t;
		}else{
			while(L<l){
				for(int i=1;i<=n;i++)if(f[i])(f[i-1]+=f[i])%=P;
				L++;
			}
			for(int i=R-L+2;i<=n;i++)f[i]=0;
			int t=sum[r]-sum[R];
			for(int i=n,x;i>=0;i--)if(f[i])x=f[i],f[i]=0,f[i+t]=x;
			R=r;
		}
	}
	int t=0;
	for(int i=0;i<=n;i++)if(f[i])t=(t+(ll)f[i]*C(R-L+1,i))%P;
	printf("%d\n",t);
	return 0;
}