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<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


ll dp[3030][3030];
int main(){
    int n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    vector<int> cnt0(n),cnt1(n);
    rep(i,n)cnt0[i]=s[i]=='0';
    rep(i,n-1)cnt0[i+1]+=cnt0[i];
    rep(i,n)cnt1[i]=s[i]=='1';
    rep(i,n-1)cnt1[i+1]+=cnt1[i];
    dp[0][0]=1;
    int c = 0;
    vector<int> l(n);
    rep(i,n)l[i]=i;
    rep(i,m){
        int x,y;
        cin>>x>>y;
        --x;--y;
        l[x]=max(l[x],y);
    }
    rep(i,n-1)l[i+1]=max(l[i+1],l[i]);
    rep(i,n)rep(j,n+1){
        dp[i][j]%=mod;
        if(j+1<=cnt0[l[i]])dp[i+1][j+1]+=dp[i][j];
        if(i+1-j<=cnt1[l[i]])dp[i+1][j]+=dp[i][j];
    }
    cout<<dp[n][cnt0[n-1]]%mod;
    return 0;
}