#include <bits/stdc++.h>
using namespace std;
int n, m, dp[5005][5005][2];
char s[5001];
int solve(int i = 0, int k = 0, int f = 0) {
  if (k < 0) return 0;
  if (i == n) return 1;
  int &ret = dp[i][k][f];
  if (~ret) return ret;
  ret = 0;
  ret = solve(i + 1, k + (s[i] == 'f'), s[i] == 'f');
  if (!f) ret += solve(i, k - 1, f);
  if (ret >= 1000000007) ret -= 1000000007;
  return ret;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
  }
  if (s[n - 1] == 'f') {
    cout << "0\n";
    return 0;
  }
  int x = solve();
  cout << x % 1000000007 << endl;
  return 0;
}
