#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)5007;
const int base = 37;
const int infint = (int)1e9;
const long long inf = (long long)1e18 + 9;
long long dp[MAXN][MAXN];
char c[MAXN];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> c[i];
  if (c[0] == 's')
    dp[0][0] = 1;
  else
    dp[0][1] = 1;
  dp[0][0] += dp[0][1];
  for (int i = 1; i < n; i++) {
    for (int depth = 0; depth <= n; depth++) {
      if (c[i] == 'f' and depth != 0) {
        dp[i][depth] = (dp[i - 1][depth - 1] - dp[i - 1][depth] + MOD) % MOD;
      } else if (c[i] == 's') {
        dp[i][depth] = dp[i - 1][depth];
      }
    }
    for (int depth = n - 1; depth >= 0; depth--)
      dp[i][depth] = (dp[i][depth] + dp[i][depth + 1]) % MOD;
  }
  cout << (dp[n - 1][0] - dp[n - 1][1] + MOD) % MOD;
}
