#include <bits/stdc++.h>
using namespace std;
int MOD;
int n;
int dp[2][5003][2];
void mod(int &nr) {
  if (nr >= MOD) nr -= MOD;
}
void init0(int cr, int fors) {
  int i;
  for (i = 1; i <= fors; i++) {
    dp[cr][i][0] = dp[cr][i][1] = 0;
  }
}
int main() {
  MOD = (1e9) + 7;
  int rez = 0;
  cin >> n;
  int ant = 0;
  int cr = 1;
  dp[ant][1][1] = 1;
  int fors = 1;
  char c;
  int i, j;
  for (i = 1; i <= n; i++) {
    cin >> c;
    fors += (c == 'f');
    init0(cr, fors);
    if (c == 'f') {
      for (j = 2; j <= fors; j++) dp[cr][j][0] = dp[ant][j - 1][0];
    }
    if (c == 's') {
      for (j = 2; j <= fors; j++) dp[cr][j][1] = dp[ant][j][0];
    }
    int loc = (c == 's');
    int e = (c == 'f');
    int sum = 0;
    for (j = fors; j >= 1; j--) {
      sum += dp[ant][j][1];
      mod(sum);
      dp[cr][j + e][loc] += sum;
      mod(dp[cr][j + e][loc]);
    }
    cr = 1 - cr;
    ant = 1 - ant;
  }
  for (i = 1; i <= fors; i++) {
    rez += dp[ant][i][1];
    mod(rez);
  }
  cout << rez << "\n";
  return 0;
}
