There is a string S of length N consisting of characters `0` and `1`. You will perform the following operation for each i = 1, 2, ..., m:

* Arbitrarily permute the characters within the substring of S starting at the l_i-th character from the left and extending through the r_i-th character.



Here, the sequence l_i is non-decreasing.

How many values are possible for S after the M operations, modulo 1000000007(= 10^9+7)?

Constraints

* 2≦N≦3000
* 1≦M≦3000
* S consists of characters `0` and `1`.
* The length of S equals N.
* 1≦l_i < r_i≦N
* l_i ≦ l_{i+1}

Input

The input is given from Standard Input in the following format:


N M
S
l_1 r_1
:
l_M r_M


Output

Print the number of the possible values for S after the M operations, modulo 1000000007.

Examples

Input

5 2
01001
2 4
3 5


Output

6


Input

9 3
110111110
1 4
4 6
6 9


Output

26


Input

11 6
00101000110
2 4
2 3
4 7
5 6
6 10
10 11


Output

143
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < n; ++i)

char s[3001];
int n, m, mx[3001], mn[3001], md = 1e9 + 7, x[3001], an[3001][3001];

int main() {
	scanf("%d%d%s", &n, &m, s);
	f(i, 0, n)mx[i + 1] = mn[i + 1] = x[i + 1] = x[i] + (s[i] == '1');
	int L = 0;
	while (m--) {
		int l, r;
		scanf("%d%d", &l, &r);
		if (r <= L)continue;
		int a = mn[l - 1], b = mx[l - 1];
		int z = x[r] - b;
		f(i, l, r + 1) {
			if (z >= i - l + 1)mx[i] = 1 + mx[i - 1];
			else mx[i] = mx[i - 1];
		}
		z = r - l + 1 - (x[r] - a);
		f(i, l, r + 1) {
			if (z >= i - l + 1)mn[i] = mn[i - 1];
			else mn[i] = mn[i - 1] + 1;
		}
		L = r;
	}
	an[0][0] = 1;
	f(i, 0, n) {
		int a = mn[i], b = mx[i];
		f(j, a, b + 1) {
			if (j >= mn[i + 1] && j <= mx[i + 1]) {
				an[i + 1][j] += an[i][j];
				if (an[i + 1][j] >= md)an[i + 1][j] -= md;
			}
			if (j + 1 >= mn[j + 1] && j + 1 <= mx[i + 1]) {
				an[i + 1][j + 1] += an[i][j];
				if (an[i + 1][j + 1] >= md)an[i + 1][j + 1] -= md;
			}
		}
	}
	printf("%d\n", an[n][x[n]]);
}