#include <bits/stdc++.h>
using namespace std;
long long dp[5005][5005];
int main() {
  long long i = 0, j = 0, k = 0, ans = 0, max_level = 1;
  ;
  long long n;
  ;
  scanf("%lld", &n);
  ;
  ;
  char a, prev;
  for (i = 0; i < n; i++) {
    scanf(" %c", &a);
    for (j = 0; j < max_level + 1; j++) dp[i][j] = 0;
    if (i) {
      if (prev == 's') {
        long long last = 0;
        for (j = max_level + 1 - 1; j >= 1; j--) {
          last = (last + dp[i - 1][j]) % 1000000007;
          dp[i][j] = (dp[i][j] + last) % 1000000007;
        }
      } else if (prev == 'f') {
        for (j = 1; j < max_level + 1; j++) {
          dp[i][j + 1] = dp[i - 1][j];
        }
        max_level += 1;
      }
    } else {
      dp[i][1] = 1;
    }
    prev = a;
  }
  for (i = 0; i < 5005; i++) ans = (ans + dp[n - 1][i]) % 1000000007;
  ;
  printf("%lld\n", ans);
  return 0;
}
