codeparrot/codecomplex huggingface dataset:
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        final int P = (int) 1e9 + 7;
        int n;
        char[] commands;
        int[][] memo;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            n = in.nextInt();
            commands = new char[n];
            memo = new int[n][12345];
            for (int i = 0; i < n; i++) {
                commands[i] = in.next().charAt(0);
                for (int j = 0; j < 12345; j++) {
                    memo[i][j] = -1;
                }
            }
            out.print(solve(1, 0));
        }

        int add(int a, int b) {
            return ((a % P) + (b % P)) % P;
        }

        int solve(int i, int indents) {
            if (i == n) return 1;
            if (memo[i][indents] != -1) return memo[i][indents];
            int answer;
            if (commands[i - 1] == 'f') {
                answer = solve(i + 1, indents + 1);
            } else {
                if (indents == 0) {
                    answer = solve(i + 1, indents);
                } else {
                    answer = add(solve(i, indents - 1), solve(i + 1, indents));
                }
            }
            return memo[i][indents] = answer;
        }

    }

    static class InputReader {
        private StringTokenizer tokenizer;
        private BufferedReader reader;

        public InputReader(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private void fillTokenizer() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        }

        public String next() {
            fillTokenizer();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Liavontsi Brechka
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static
    @SuppressWarnings("Duplicates")
    class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int MAX = 6000;
            int MOD = 1000000007;

            int n = in.nextInt();
            int[][] dp = new int[n][MAX];
            dp[0][0] = 1;

            char next;
            int current;
            for (int i = 0; i < n; i++) {
                next = in.next().charAt(0);
                if (i == n - 1) continue;

                current = 0;
                for (int j = MAX - 1; j >= 0; j--) {
                    if (dp[i][j] != 0) {
                        if (next == 'f') {
                            if (j < MAX - 1) dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i][j]) % MOD;
                        } else {
                            current = (current + dp[i][j]) % MOD;
                        }
                    }

                    if (next == 's') dp[i + 1][j] = current;
                }
            }

            int res = 0;
            for (int i = 0; i < MAX; i++) {
                res = (res + dp[n - 1][i]) % MOD;
            }

            out.print(res);
        }

    }

    static class InputReader {
        private final BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public String readLine() {
            String line;
            try {
                line = reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            return line;
        }

    }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class C {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        List<String> commands = IntStream.range(0, n).boxed().map(x -> s.next()).collect(Collectors.toList());
        List<Integer> ways = new ArrayList<>();
        ways.add(1);
        boolean lastWasS = false;
        for (String command : commands) {
            boolean isS = "s".equals(command);

            if (lastWasS) {
                for (int i = 1; i < ways.size(); ++i) {
                    int waysNumber = (ways.get(i-1) + ways.get(i)) % 1_000_000_007;
                    ways.set(i, waysNumber);
                }
            }

            if (!isS) {
                ways.add(0);
            }

            lastWasS = isS;
        }
        System.out.println(ways.stream().reduce(0, (a, b) -> (a + b) % 1_000_000_007));
    }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*
 public class _909C {

 }

 */
public class _909C {
  int mod = (int) 1e9 + 7;

  public void solve() throws FileNotFoundException {
    InputStream inputStream = System.in;

    InputHelper in = new InputHelper(inputStream);

    // actual solution
    int n = in.readInteger();

    char[] a = new char[n];

    for (int i = 0; i < n; i++) {
      a[i] = in.read().charAt(0);
    }

    int[][][] dp = new int[2][n + 1][2];

    dp[0][0][0] = dp[0][0][1] = 1;

    for (int i = 1; i < n; i++) {
      for (int j = n; j >= 0; j--) {
        if (a[i - 1] == 's') {
          dp[1][j][0] = dp[1][j][1] = dp[0][j][1];
        } else {
          if (j > 0)
            dp[1][j][0] = dp[1][j][1] = dp[0][j - 1][0];
        }
      }

      for (int j = 0; j <= n; j++) {
        dp[0][j][0] = dp[1][j][0];
        dp[0][j][1] = dp[1][j][1];
        dp[1][j][0] = 0;
        dp[1][j][1] = 0;
      }
      for (int j = n - 1; j >= 0; j--) {
        dp[0][j][1] += dp[0][j + 1][1];
        dp[0][j][1] %= mod;
      }
    }

    System.out.println(dp[0][0][1]);
    // end here
  }

  public static void main(String[] args) throws FileNotFoundException {
    (new _909C()).solve();
  }

  class InputHelper {
    StringTokenizer tokenizer = null;
    private BufferedReader bufferedReader;

    public InputHelper(InputStream inputStream) {
      InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
      bufferedReader = new BufferedReader(inputStreamReader, 16384);
    }

    public String read() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          String line = bufferedReader.readLine();
          if (line == null) {
            return null;
          }
          tokenizer = new StringTokenizer(line);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }

      return tokenizer.nextToken();
    }

    public Integer readInteger() {
      return Integer.parseInt(read());
    }

    public Long readLong() {
      return Long.parseLong(read());
    }
  }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.*;

public class Main {

    static int N;
    static int [][] dp;
    static int M = (int)(1e9 + 7);
    static ArrayList<Integer> l;

    static int f(int idx, int b) {
        if(idx == l.size())
            return 1;
        if(dp[idx][b] != -1)
            return dp[idx][b];
        long ret = f(idx + 1, b + l.get(idx));
        if(b > 0)
            ret += f(idx, b - 1);
        return dp[idx][b] = (int) (ret % M);
    }

    public static void main(String[] args) throws IOException{
	    Scanner sc = new Scanner();
	    N = sc.nextInt();
        int [] val = new int[N];
        for(int i = 0; i < N; ++i)
            if(sc.next().charAt(0) == 's')
                val[i] = 0;
            else
                val[i] = 1;
        l = new ArrayList<Integer>();
        l.add(val[0]);

        for(int i = 1; i < N; ++i)
            if(val[i] == val[i - 1] && val[i] == 1) {
                int prev = l.get(l.size() - 1);
                l.set(l.size() - 1, ++prev);
            } else if(val[i - 1] == 0){
                l.add(val[i]);
            }

//        System.out.println(l);
        dp = new int[l.size() + 1][N + 1];
        for(int i = 0; i <= l.size(); ++i)
            Arrays.fill(dp[i], -1);
        System.out.println(f(0, 0));

    }


    static class Scanner {
        BufferedReader br;
        StringTokenizer st;

        Scanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(br.readLine());
            }
            return st.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

    }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.lang.Math;
import java.io.*;    
import java.util.*;
 
public class Main {
        
        static BufferedReader in;
        static PrintStream out;
        static StringTokenizer tok;
        
        @SuppressWarnings("empty-statement")
	public static void main(String[] args) throws NumberFormatException, IOException, Exception {
            in = new BufferedReader(new InputStreamReader(System.in));
            //in = new BufferedReader(new FileReader("metro.txt"));
            out = System.out;
            
            long mod = (long)1e9 + 7;
            int n = nextInt();
            long[][] dp = new long[n+1][n+1];
            Character[] line = new Character[n+1];
            line[0] = 'a';
            for (int i = 1; i <= n; i++) {
                line[i] = nextToken().charAt(0);
                if(line[i-1] == 'f')//for
                {
                    for (int j = 0; j < i; j++) {
                        dp[i][j+1] = dp[i-1][j];
                    }
                }
                else if(line[i-1] == 's')//simple
                {
                    long temp = 0;
                    for(int j = i; j >=0; j--)
                    {
                        temp = (temp + dp[i-1][j]) % mod;
                        dp[i][j] = temp;
                    }
                }
                else dp[i][0] = 1;
            }
            long total = 0;
            for(int j = 0; j <= n; j++)
                total = (total + dp[n][j]) % mod;
            out.println(total);
        }
        static String nextToken() throws IOException
        {
                String line = "";
                while(tok == null || !tok.hasMoreTokens()) {
                        if((line = in.readLine()) != null)
                                tok = new StringTokenizer(line);
                        else 
                                return null;
                }
                return tok.nextToken();
        }
        static int nextInt() throws NumberFormatException, IOException
        {
                return Integer.parseInt(nextToken());
        }
        static long nextLong() throws NumberFormatException, IOException
        {
                return Long.parseLong(nextToken());
        }

}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic

import java.util.*;
public class init {
static class p{
	int i;
	int c;
	public p(int i,int c) {
		this.i=i;this.c=c;
		// TODO Auto-generated constructor stub
	}
}
static int mod=1000000007;
	public static void main(String[] args) {
	
		// TODO Auto-generated method stub
Scanner s=new Scanner(System.in);
int n=s.nextInt();
int a[]=new int[n];
for(int i=0;i<n;i++) {
	char c=s.next().charAt(0);
	if(c=='f')
		a[i]=1;
		
}
int dp[][]=new int[n+1][n+1];
for(int i=0;i<=n;i++) {
	for(int j=0;j<=n;j++)
		dp[i][j]=-1;
}
System.out.println(ans(dp,1,0,a,n));
	}
	public static int ans(int dp[][],int i,int j,int a[],int n) {
		if(i==n) {
			
			return 1;
		}
		if(dp[i][j]!=-1) {
			return dp[i][j];
		}
		if(a[i-1]==1) {
			int x=ans(dp,i+1,j+1,a,n);
			if(x!=-1)
				dp[i][j]=x%mod;
		}
		else {
			int x=-1;
			if(j!=0)
			x=ans(dp,i,j-1,a,n);
			int y=ans(dp,i+1,j,a,n);
			if(x!=-1)
				dp[i][j]=x%mod;
			if(y!=-1) {
				if(dp[i][j]==-1)
					dp[i][j]=y%mod;
				else
				dp[i][j]+=y%mod;}
		}
		return dp[i][j];
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.*;
import java.util.*;

public class Codeforces455Div2C {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sp = br.readLine().split(" ");
		int n = Integer.parseInt(sp[0]);
		char[] list = new char[n];
		for (int i = 0; i < n; i++) {
			sp = br.readLine().split(" ");
			list[i] = sp[0].charAt(0);
		}
		
		int[] list2 = new int[n];
		int counter = 0;
		for (int i = 0; i < n; i++) {
			if (list[i] == 's') {
				counter++;
			}
			else {
				list2[counter]++;
			}
		}
		
		int[][] dp = new int[counter][n-counter+1];
		int[][] dpsum = new int[counter][n-counter+1];
		int[] count = new int[counter];
		count[0] = list2[0];
		for (int i = 1; i < counter; i++) {
			count[i] = count[i-1] + list2[i];
		}
		
		for (int i = 0; i <= count[0]; i++) {
			dp[0][i] = 1;
			dpsum[0][i] = i+1;
		}
		for (int i = 1; i < counter; i++) {
			for (int j = 0; j <= count[i]; j++) {
				dp[i][j] = dpsum[i-1][Math.min(j, count[i-1])];
			}
			dpsum[i][0] = dp[i][0];
			for (int j = 1; j <= count[i]; j++) {
				dpsum[i][j] = (dpsum[i][j-1]+dp[i][j])%1000000007;
			}
		}
		
		System.out.println(dp[counter-1][n-counter]);
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.util.Arrays;
import java.util.Scanner;

public class ProblemC {
	static long MOD = 1_000_000_007;

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		boolean[] isFor = new boolean[n];
		for (int a = 0; a < n; a++) {
			isFor[a] = input.next().charAt(0) == 'f';
		}
		long[][] array = new long[n + 1][n + 1];
		array[0][0] = 1;
		boolean isPreviousFor = false;
		for (int idx = 0; idx < n; idx++) {
			long heightCache = 0;
			for (int height = n-1; height >= 0; height--) {
				if (isPreviousFor) {
					array[idx + 1][height + 1] += array[idx][height];
					array[idx + 1][height + 1] %= MOD;
				} else {
					heightCache += array[idx][height];
					heightCache %= MOD;
					array[idx + 1][height] += heightCache;
					array[idx + 1][height] %= MOD;
				}
			}
			isPreviousFor = isFor[idx];
		}
//		System.out.println(Arrays.deepToString(array));
		long sum = 0;
		for (int height = 0; height <= n; height++) {
			sum += array[n][height];
		}
		System.out.println(sum % MOD);
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.util.Scanner;

//http://codeforces.com/contest/909/problem/C
public class PythInd {
	public static final int MOD = 1000000007;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] sTypes = new String[n];
		for (int i = 0; i < n; i++) {
			sTypes[i] = sc.nextLine();
		}
		sc.close();
		// dp[i][j] = number of ways to have a for loop indented
		// j times at the ith position.
		int[][] dp = new int[n][n];
		dp[0][0] = 1;
		for (int i = 0; i < dp.length - 1; i++) {
			if (sTypes[i].equals("s")) {
				int curSum = 0;
				for (int j = i + 1; j >= 0; j--) {
					curSum = (dp[i][j] + curSum) % MOD;
					dp[i + 1][j] += curSum;
					dp[i + 1][j] %= MOD;
				}
			} else {
				for (int j = 1; j <= i + 1; j++) {
					dp[i + 1][j] += dp[i][j - 1];
					dp[i + 1][j] %= MOD;
				}
			}
		}
		int ans = 0;
		for (int i = 0; i < dp[0].length; i++) {
			ans = (ans + dp[n - 1][i]) % MOD;
		}
		System.out.println(ans);
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.util.*;
public class A{
       
       public static int mod = 1000000007;
       
       public static void main(String args[]){
              Scanner sc = new Scanner(System.in);
              int n = sc.nextInt();
              char s[] = new char[n];
              for(int i = 0; i < n; i++)
                     s[i] = sc.next().charAt(0);
              int dp[][] = new int[5001][5001];
              int sum[][] = new int[5001][5001];
              dp[0][0] = 1;
              sum[0][0] = 1;
              for(int i = 1; i < n; i++){
                     for(int j = n - 1; j >= 0; j--){
                            if(s[i-1] == 'f' && j > 0){
                                   dp[i][j] = dp[i-1][j-1] % mod;
                            }else if(s[i-1] == 's'){
                                   dp[i][j] = sum[i-1][j] % mod;
                            }
                            sum[i][j] = (sum[i][j+1] + dp[i][j]) % mod;
                     }
              }
              System.out.println(sum[n-1][0]);
       }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;


public class C {

	static StringTokenizer st;
	static BufferedReader br;
	static PrintWriter pw;
	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		int n = nextInt();
		int[]dp1 = new int[n+1];
		int[]dp2 = new int[n+1];
		dp1[1] = 1;
		int mod = (int) (1e9+7);
		char[]instruction = new char[n+1];
		instruction[0] = 's';
		int[]sum = new int[n+1];
		for (int i = 1; i <= n; i++) {
			instruction[i] = next().charAt(0);
			for (int j = 1; j <= i; j++) {
				sum[j] = sum[j-1] + dp1[j];
				if (sum[j] >= mod)
					sum[j] -= mod;
			}
			for (int j = 1; j <= i; j++) {
				if (instruction[i-1]=='f')
					dp2[j] = dp1[j-1];
				else {
					dp2[j] = sum[i] - sum[j-1];
					if (dp2[j] < 0)
						dp2[j] += mod;
				}
			}
			for (int j = 1; j <= i; j++) {
				dp1[j] = dp2[j];
			}
		}
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			ans += dp1[i];
			if (ans >= mod)
				ans -= mod;
		}
		System.out.println(ans);
		pw.close();
	}
	private static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}
	private static long nextLong() throws IOException {
		return Long.parseLong(next());
	}
	private static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}
	private static String next() throws IOException {
		while (st==null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;


public class C455C {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		ArrayList<Integer> listCount = new ArrayList<Integer>();
		listCount.add(1);
		boolean justf = false;
		int p = 1000000007;
		long ans = 0;
		
		for(int x=0; x<n; x++){
			String next = sc.nextLine();
			
			if(next.equals("f")){
				
				if(justf){
					listCount.add(0);
				}
				else{
					
					for(int i=1; i<listCount.size(); i++){
						int sum = (listCount.get(i-1) + listCount.get(i)) % p;
						listCount.set(i, sum);
					}
					
					listCount.add(0);
				}
				
				justf = true;
			}
			else{ // "s"
				if(justf){
					justf = false;
				}
				else{
					for(int i=1; i<listCount.size(); i++){
						int sum = (listCount.get(i-1) + listCount.get(i)) % p;
						listCount.set(i, sum);
					}
				}
			}
			
			//System.out.println(listCount);
		}
		
		for(int i=0; i<listCount.size(); i++){
			ans += listCount.get(i);
		}
		
		System.out.print((ans % p));
	}
}

/*
int n = Integer.parseInt(sc.nextLine());
String[] t = sc.nextLine().split(" ");
int[] list = new int[n];
for(int x=0; x<n; x++){
	list[x] = Integer.parseInt(t[x]);
}
		
String[] dir = sc.nextLine().split(" ");
int a = Integer.parseInt(dir[0]);
int b = Integer.parseInt(dir[1]);
int c = Integer.parseInt(dir[2]);
int d = Integer.parseInt(dir[3]);
int e = Integer.parseInt(dir[4]);

int n = Integer.parseInt(sc.nextLine());
*/
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.util.Scanner;

public class Solution {
		
	public static void main(String[] args) {
		// Write your code here
      Scanner s=new Scanner(System.in);
	  int n=s.nextInt();
	  char[] seq=new char[n];
	  for(int i=0;i<n;i++){
		  seq[i]=s.next().charAt(0);  
	  }
	  long mod=(long)Math.pow(10,9)+7;
	  long[][] arr=new long[n][n];
	  arr[0][0]=1;
	  for(int i=1;i<n;i++){
		  if(seq[i-1]=='f'){
			  for(int j=1;j<n;j++){
				  arr[i][j]=arr[i-1][j-1];
			  }
		  }else{
			  long sum=0;
			  for(int j=n-1;j>=0;j--){
				  sum=(sum+arr[i-1][j])%mod;
				  arr[i][j]=sum;
			  }
		  }
	  }
	  long ans=0;
	  for(int i=0;i<n;i++){
		  ans=(ans+arr[n-1][i])%mod;
	  }
	  System.out.println(ans);
	}
}