#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 5;
int n, dp[N][N][2];
char a[N];
int calc(int i, int at, bool f) {
  if (i == n) return 1;
  int &ret = dp[i][at][f];
  if (ret != -1) return ret;
  ret = 0;
  ret += calc(i + 1, at + (a[i] == 'f'), (a[i] == 'f'));
  if (!f && at > 0) ret += calc(i, at - 1, 0);
  if (ret > 1000000007) ret -= 1000000007;
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf(" %c", a + i);
  }
  memset(dp, -1, sizeof dp);
  cout << calc(0, 0, false);
}
