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 <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>

using namespace std;
typedef long long ll;
typedef pair<int,int> Pi;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) (int)x.size()
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) x.begin(), x.end()

const int MOD = 1e9 + 7;
int D[4040][4040];

void solve(){
	int n, m; scanf("%d%d", &n, &m);
	char S[2][3030];
	scanf("%s", S[0]+1);
	for(int i=1;i<=n;i++)S[1][i] = S[0][i];
	rep(i, m){
		int x, y; scanf("%d%d", &x, &y);
		sort(S[0]+x, S[0]+y+1);
		sort(S[1]+x, S[1]+y+1, [](int x,int y){return x > y;});
	}
	int s[2][4040] = {};
	rep(u, 2)for(int i=1;i<=n;i++)s[u][i] = s[u][i-1] + (S[u][i] == '1');
	D[0][0] = 1;
	for(int i=1;i<=n;i++){
		for(int j=s[0][i];j<=s[1][i];j++)D[i][j] = ((j?D[i-1][j-1]:0) + D[i-1][j]) % MOD;
	}
	printf("%d", D[n][s[0][n]]);
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}