#include <bits/stdc++.h>

const int MAXN = 3010;
const int mod = 1000000007;
void reduce(int & x) { x += x >> 31 & mod; }
char buf[MAXN];
int rs[MAXN], n, m;
int pre[MAXN];
int f[MAXN][MAXN];
int main() {
	std::ios_base::sync_with_stdio(false), std::cin.tie(0);
	std::cin >> n >> m >> buf + 1;
	for (int i = 1; i <= n + 1; ++i) rs[i] = i;
	for (int i = 1, a, b; i <= m; ++i)
		std::cin >> a >> b, rs[a] = std::max(rs[a], b);
	for (int i = 1; i <= n; ++i) rs[i] = std::max(rs[i], rs[i - 1]);
	for (int i = 1; i <= n; ++i)
		pre[i] = pre[i - 1] + (buf[i] & 1);
	f[0][0] = 1;
	for (int i = 1; i <= n; ++i) {
		for (int j = 0; j <= n; ++j) if (int t = f[i - 1][j]) {
			int hav = j + pre[rs[i]] - pre[rs[i - 1]];
			reduce(f[i][hav] += t - mod);
			if (hav) reduce(f[i][hav - 1] += t - mod);
		}
		for (int j = 0; j <= n; ++j)
			if (rs[i] - i - j < 0) f[i][j] = 0;
	}
	std::cout << f[n][0] << std::endl;
	return 0;
}
