Problem:
Score : 1100 points

Problem Statement

There are N white balls arranged in a row, numbered 1,2,..,N from left to right.
AtCoDeer the deer is thinking of painting some of these balls red and blue, while leaving some of them white.

You are given a string s of length K.
AtCoDeer performs the following operation for each i from 1 through K in order:

The i-th operation: Choose a contiguous segment of balls (possibly empty), and paint these balls red if the i-th character in s is r; paint them blue if the character is b.

Here, if a ball which is already painted is again painted, the color of the ball will be overwritten.
However, due to the properties of dyes, it is not possible to paint a white, unpainted ball directly in blue.
That is, when the i-th character in s is b, the chosen segment must not contain a white ball.

After all the operations, how many different sequences of colors of the balls are possible?
Since the count can be large, find it modulo 10^9+7.

Constraints

1 ≤ N ≤ 70

1 ≤ K ≤ 70

|s| = K

s consists of r and b.

N and K are integers.

Input

Input is given from Standard Input in the following format:

N K
s

Output

Print the number of the different possible sequences of colors of the balls after all the operations, modulo 10^9+7.

Sample Input 1

2 2
rb

Sample Output 1

9

There are nine possible sequences of colors of the balls, as follows:

ww, wr, rw, rr, wb, bw, bb, rb, br.

Here, r represents red, b represents blue and wrepresents white.

Sample Input 2

5 2
br

Sample Output 2

16

Since we cannot directly paint white balls in blue, we can only choose an empty segment in the first operation.

Sample Input 3

7 4
rbrb

Sample Output 3

1569

Sample Input 4

70 70
bbrbrrbbrrbbbbrbbrbrrbbrrbbrbrrbrbrbbbbrbbrbrrbbrrbbbbrbbrbrrbbrrbbbbr

Sample Output 4

841634130

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=75,mo=1e9+7;
int n,k,_N;
char s[N];
int cnt[N],a[N],mrk[N],f[N],st[N],t,sf[N];
ll Ans,jc[N*10],ny[N*10];
ll power(ll a,ll b=mo-2){
	ll ans=1;
	while (b){
		if (b&1)ans=ans*a%mo;
		a=a*a%mo;
		b>>=1;
	}return ans;
}
ll C(ll n,ll m){
	return ny[m]*ny[n-m]%mo*jc[n]%mo;
}
int check(int n){
	if (n==0){
		Ans++;
		return 1;
	}
	memset(mrk,0,sizeof mrk);
	memset(f,0,sizeof f);
	memset(sf,0,sizeof sf);
	if (!st[n])return 0;
	for (int i=1;i<=n;i++){
		mrk[st[i]]=1;
		for (int j=max(st[i],f[i-1]);s[j];j++)
			if (s[j]=='b'&&!mrk[j]){
				f[i]=j;
				mrk[j]=1;
				break;
			}
		if (a[i]==1)mrk[f[i]]=0,f[i]=0;
		if (!st[i]||!f[i]&&a[i]>1)return 0;
		if (a[i]==1)break;
	}
	for (int i=k;i>=1;i--)
		sf[i]=sf[i+1]+(!mrk[i]);
	for (int i=1;i<=n;i++)
		if (sf[f[i]]+2<a[i])return 0;
	
	ll n1=1,m1=2,ans=1,sum=0;
	for (int i=1;i<=_N;i++)
		sum+=cnt[i],ans=ans*ny[cnt[i]]%mo;
	ans=ans*jc[sum]%mo;
	for (int i=1;i<=n;i++)
		n1+=2*a[i],m1+=2*(a[i]>=2);
	ans=ans*C(_N+m1-1,n1-1);
	Ans=(Ans+ans)%mo;
//	cout<<ans<<endl;
	return 1;
}
int ccnt=0;
void dfs(int x,int s,int la){
	if (s>n+1)return;
	if (!check(x-1))return;
	for (int i=1;i<=la;i++){
		a[x]=i;
		cnt[i]++;
		dfs(x+1,s+max(2,2*(i-1)),i);
		cnt[i]--;
	}
}
int main(){
	cin>>n>>k;_N=n;
	jc[0]=ny[0]=1;
	for (int i=1;i<=700;i++)jc[i]=jc[i-1]*i%mo;
	ny[700]=power(jc[700]);
	for (int i=700;i>=1;i--)ny[i-1]=ny[i]*i%mo;
	scanf("%s",s+1);
	for (int i=1;i<=k;i++){
		if (s[i]=='r')st[++t]=i;
	}
	dfs(1,0,n);
	cout<<Ans<<endl;
}