#include <bits/stdc++.h>
using namespace std;
string compressed = "";
vector<int> suffix;
int n;
const long long MOD = 1e9 + 7;
int dp[5005][5005][2];
int sol(int i, int lev, int prev = 0) {
  if (i == n) return 1;
  if (lev < 0) return 0;
  int& ret = dp[i][lev][prev];
  if (ret != -1) return ret;
  int isF = (compressed[i] == 'f');
  if (prev == 1)
    ret = sol(i + 1, lev + isF, isF);
  else
    ret = (sol(i, lev - 1, prev) % MOD) + (sol(i + 1, lev + isF, isF) % MOD);
  return (ret % MOD);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  memset(dp, -1, sizeof(dp));
  cin >> n;
  string s(n, 'x');
  for (int i = 0; i < n; i++) cin >> s[i];
  compressed = s;
  cout << sol(0, 0);
}
