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: Accepted)

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
int n,m,k,a[75],len[75],tmp[75],st[75];
ll ans,fact[205],inv[205];
char s[75];
bool flag[75];
queue<int>q;
ll quick_pow(ll x,ll a)
{
	ll ans=1;
	while(a)
	{
		if(a&1)ans=ans*x%MOD;
		x=x*x%MOD;
		a>>=1;
	}
	return ans;
}
bool check()
{
	memset(flag,0,sizeof(flag));
	while(!q.empty())q.pop();
	int tot=0;
	for(int i=m;i;i--)
	{
		for(int j=1;j<=a[i];j++)
		  tmp[++tot]=i-1;
	}
	int now=1;
	for(int i=1;i<=k;i++)
	{
		if(s[i]=='r')
		{
			q.push(i);
		}
		if(s[i]=='b')
		{
			if(now<=tot&&!q.empty())
			{
				st[now]=i;
				flag[q.front()]=flag[i]=1;
				q.pop();
				now++;
			}
		}
	}
	if(now<=tot)return 0;
	for(int i=1;i<=a[0];i++)
	{
		if(q.empty())return 0;
		flag[q.front()]=1;
		q.pop();
	}
	now=1;
	for(int i=1;i<=tot;i++)
	{
		while(now<=st[i])now++;
		for(int j=1;j<=tmp[i];j++)
		{
			while(flag[now])now++;
			if(now>k)return 0;
			flag[now]=1;
		}
	}
	return 1;
}
ll solve()
{
	if(!check())return 0;
	int l=n,tot=0;
	for(int i=0;i<=m;i++)
	{
		l-=a[i]*(len[i]+1);
		tot+=a[i];
		tot+=a[i]*(2*i+1);
	}
	l++;
	ll ans=fact[l+tot]*inv[l]%MOD*inv[tot]%MOD;
	tot=0;
	for(int i=0;i<=m;i++)
	{
		tot+=a[i];
		ans=ans*inv[a[i]]%MOD;
	}
	return ans*fact[tot];
}
void dfs(int step,int rest)
{
	if(step>m)
	{
		ans=(ans+solve())%MOD;
		return;
	}
	for(a[step]=0;a[step]*len[step]+a[step]<=rest;a[step]++)
	  dfs(step+1,rest-a[step]*len[step]-a[step]);
}
int main()
{
	scanf("%d%d",&n,&k);
	scanf("%s",s+1);
	fact[0]=1;
	for(int i=1;i<=200;i++)fact[i]=fact[i-1]*i%MOD;
	inv[200]=quick_pow(fact[200],MOD-2);
	for(int i=200;i>=1;i--)inv[i-1]=inv[i]*i%MOD;
	len[0]=len[1]=1;
	m=2;
	while(2*m-1<=n)
	{
		len[m]=2*m-1;
		m++;
	}
	m--;
	dfs(0,n+1);
	printf("%lld\n",ans);
	return 0;
}