#include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)

using namespace std;
const int N=3005,mod=1000000007;
typedef long long LL;
char S[N];
int n,m,s[N],x[N],y[N],c[N][N],tot,l[N],r[N],maxn;
LL f[N][N];
struct data{int x,y;} dat[N];

int getint()
{
	char ch;
	int f=1;
	while(!isdigit(ch=getchar())) if(ch=='-') f=-1;
	int x=ch-48;
	while(isdigit(ch=getchar())) x=x*10+ch-48;
	return x*f;
}

bool cmp(data a,data b)
{
	return a.x==b.x?a.y>b.y:a.x<b.x;
}

int main()
{
	n=getint(),m=getint(),scanf("%s",S+1);
	rep(i,0,n) c[i][0]=c[i][i]=1;
	rep(i,1,n) rep(j,1,i-1) c[i][j]=(c[i-1][j]+c[i-1][j-1])%mod;
	rep(i,1,n) s[i]=s[i-1]+S[i]-48;
	rep(i,1,m) dat[i].x=getint(),dat[i].y=getint();
	sort(dat+1,dat+1+m,cmp);
	rep(i,1,m) if(dat[i].y>maxn) ++tot,x[tot]=dat[i].x,y[tot]=dat[i].y,maxn=dat[i].y;
	f[0][0]=1,x[tot+1]=y[tot+1]=n+1;
	rep(i,1,tot)
	{
		int w=min(y[i]-x[i]+1,x[i+1]-x[i]),a=s[y[i]]-s[max(x[i]-1,y[i-1])];
		l[i]=max(0,l[i-1]+a-w),r[i]=min(max(y[i]-x[i+1]+1,0),r[i-1]+a);
		rep(j,l[i],r[i])
			rep(k,l[i-1],r[i-1])
				f[i][j]=(f[i][j]+f[i-1][k]*c[w][k+a-j])%mod;
	}
	printf("%lld\n",f[tot][0]);
	return 0;
}