#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
typedef long long ll;
#define MOD 1000000007
int dp[5005][5005]; //dp[i][j]代表第i行缩进j格的方案数
int op[5005];
int main()
{
int n;
char s[5];
while(~scanf("%d",&n))
{
for(int i=0;i<n;i++)
{
scanf("%s",s);
if(s[0]=='f')
op[i]=1;
else
op[i]=2;
}
if(op[n-1]==1)
{
printf("0\n");
continue;
}
memset(dp,0,sizeof(dp));
for(int i=0;i<n;i++)
dp[n-1][i]=1;
for(int i=n-1;i>=0;i--)
{
int sum=0;
for(int j=0;j<n;j++)
{
sum=(sum+dp[i+1][j])%MOD; //sum记录i+1行缩进小于等于j的方案数的和
if(op[i]==1) //f语句,则i+1行缩进只能为j+1
dp[i][j]=(dp[i][j]+dp[i+1][j+1])%MOD;
else //s语句,则i+1行缩进的区间为0~j之间
dp[i][j]=(dp[i][j]+sum)%MOD;
}
}
printf("%d\n",dp[0][0]);
}
}