/*
ID: skipian1
PROB: 
LANG: C++11
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF = 2000000000
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define X first
#define Y second

ll MOD = 1e9+7;

int main() {
  ll n;
  cin >> n;
  string str;
  cin >> str;
  bool paren[2*n];
  for (ll i = 0; i < 2*n; i++) {
    if (i == 0) {
      if (str.at(i) == 'W') {
	cout << 0 << "\n";
	return 0;
      }
      paren[0] = 0;
    } else {
      if (str.at(i) != str.at(i-1)) {
	paren[i] = paren[i-1];
      } else {
	paren[i] = !paren[i-1];
      }
    }
  }
  ll parens = 0;
  for (ll i = 0; i < 2*n; i++) {
    if (paren[i]) parens--;
    else parens++;
    if (parens < 0) {
      cout << 0 << "\n";
      return 0;
    }
  }
  if (parens != 0) {
    cout << 0 <<  "\n";
    return 0;
  }
  parens = 0;
  ll ans = 1;
  ll ind = 0;  
  for (ll i = 2*n-1; i >= 0; i--) {
    if (paren[i]) parens++;
    else {
      ans *= parens-ind;
      ind++;
      ans %= MOD;
    }
  }
  for (ll i = 1; i <= n; i++) {
    ans *= i;
    ans %= MOD;
  }
  cout << ans << "\n";
}

#include <bits/stdc++.h>   
#define rep(i, n) for(long long int i = 0; i < n; i++)
#define _rep(i, m, n) for(long long int i = m; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
     
ll gcd(ll A, ll B){
    if(B == 0)return A;
    return gcd(B, A % B);
}
ll lcm(ll A, ll B){
    return A * B / gcd(A, B);
}
using Graph = vector<vector<int>>;
Graph G;

int main(){
    int d; cin >> d;
    ll g; cin >> g;
    vector<ll> p(d);
    vector<ll> c(d);
    rep(i, d) cin >> p[d - 1 - i] >> c[d - 1 - i];

    int min_count = 100000000;
    int count, sum;
    bool flag;
    for(int bit = 0; bit < (1 << d); bit++){
        flag = false;
        count = 0; 
        sum = 0;
        for(int i = 0; i < d; i++){
            if(bit & (1 << i)){
                int num;
                if((g - sum) > (d - i) * 100 * p[i] + c[i]){
                    sum += (d - i) * 100 * p[i] + c[i];
                    count += p[i];
                }else{
                    num = min(((g - sum) + ((d - i) * 100) - 1) / ((d - i) * 100), p[i]);
                    count += num;
                    flag = true;
                }
            }
            if(flag) break;
        }
        //cout << count << endl;
        if(flag) min_count = min(count, min_count);
    }
    cout << min_count << endl;
}