#include <bits/stdc++.h>
using namespace std;
int N, dp[5010][5010][2], ret = 0;
char commands[5010];
long long solveIt(int curr, int depth, bool lastWasFor) {
  if (dp[curr][depth][lastWasFor] != -1) return dp[curr][depth][lastWasFor];
  if (curr == N) return dp[curr][depth][lastWasFor] = 1;
  dp[curr][depth][lastWasFor] = 0;
  if (commands[curr] == 'f') {
    if (lastWasFor)
      dp[curr][depth][lastWasFor] = solveIt(curr + 1, depth + 1, true);
    else
      for (int i = 0; i <= depth; i++)
        dp[curr][depth][lastWasFor] =
            (dp[curr][depth][lastWasFor] + solveIt(curr + 1, i + 1, true)) %
            1000000007;
  } else {
    if (lastWasFor)
      dp[curr][depth][lastWasFor] = solveIt(curr + 1, depth, false);
    else
      for (int i = 0; i <= depth; i++)
        dp[curr][depth][lastWasFor] =
            (dp[curr][depth][lastWasFor] + solveIt(curr + 1, i, false)) %
            1000000007;
  }
  return dp[curr][depth][lastWasFor];
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(18);
  cin >> N;
  memset(dp, 0, sizeof(dp));
  dp[0][0][0] = 1;
  for (int i = 1; i <= N; i++) cin >> commands[i];
  commands[0] = 's';
  for (int i = 1; i <= N; i++) {
    int cumSumNotFor = 0;
    for (int j = 5005; j > -1; j--) {
      cumSumNotFor = (cumSumNotFor + dp[i - 1][j][0]) % 1000000007;
      if (commands[i] == 'f') {
        if (commands[i - 1] == 'f')
          dp[i][j][1] = dp[i - 1][j - 1][1];
        else
          dp[i][j][1] = cumSumNotFor;
      } else {
        if (commands[i - 1] == 'f')
          dp[i][j][0] = dp[i - 1][j - 1][1];
        else
          dp[i][j][0] = cumSumNotFor;
        if (i == N) ret = (ret + dp[i][j][0]) % 1000000007;
      }
    }
  }
  cout << ret << '\n';
  return 0;
}
