#include <bits/stdc++.h>
using namespace std;
const int N = 5009;
int dp[N][N], n;
char a[N];
int mod = 1e9 + 7;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  dp[n][1] = 1;
  for (int i = n - 1; i >= 0; i--) {
    for (int nested = 1; nested <= n + 1; nested++) {
      if (a[i] == 'f') {
        dp[i][nested] = dp[i + 1][nested + 1];
      } else {
        dp[i][nested] =
            (0LL + dp[i + 1][nested] + (nested > 1) * dp[i][nested - 1]) % mod;
      }
    }
  }
  cout << dp[0][1];
}
