codeparrot/codecomplex huggingface dataset:
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.*;
import java.util.*;

public class utkarsh{
	BufferedReader br;

	void solve(){
		br = new BufferedReader(new InputStreamReader(System.in));
		int i, j, n, mod = (int)(1e9 + 7);
		n = ni();
		char c[] = new char[n];
		for(i = 0; i < n; i++)	c[i] = ns().charAt(0);
		long dp[][] = new long[n][n];
		dp[0][0] = 1;
		for(i = 1; i < n; i++){
			if(c[i-1] == 'f'){
				for(j = 0; j < i; j++){
					dp[i][j+1] = dp[i-1][j];
				}
			}else{
				for(j = i-1; j >= 0; j--){
					dp[i][j] = dp[i-1][j] + dp[i][j+1];
					dp[i][j] %= mod;
				}
			}
		}
		long ans = 0;
		for(long x : dp[n-1]){
			ans += x;
			ans %= mod;
		}
		System.out.println(ans);
	}

	int ni(){
		return Integer.parseInt(ns());
	}

	String ip[];
	int len, sz;

	String ns(){
		if(len >= sz){
			try{
				ip = br.readLine().split(" ");
				len = 0;
				sz = ip.length;
			}catch(IOException e){
				throw new InputMismatchException();
			}
			if(sz <= 0)	return "-1";
		}
		return ip[len++];
	}

	public static void main(String[] args){	new utkarsh().solve();	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class c {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int numbOfStatements = in.nextInt();
		long[] dp = new long[numbOfStatements];
		dp[0] = 1L;
		boolean priorFor = in.next().equals("f");
		
		for(int i=0; i<numbOfStatements-1; i++)
		{
			String type = in.next();
			if (priorFor) {
				for(int j=numbOfStatements-1;j>0;j--) {
					dp[j] = dp[j-1];
				}
				dp[0] = 0L;
			} else {
				long sum = 0;
				for(int j = numbOfStatements - 1; j >= 0; --j) {
					sum = (sum + dp[j])  % 1000000007;
					dp[j] = sum;
				}
			}
			priorFor = type.equals("f");
		}
		long ans = 0;
		for(int j=0; j<numbOfStatements; j++) {
			ans = (ans + dp[j]) % 1000000007;
		}
		System.out.println(ans);
	}

}
// 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;

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 {
        static final int modular = (int) (1e9 + 7);

        public void solve(int testNum, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int ans = 0;
            String[] g = new String[n];
            int[][] dp = new int[2][n];
            for(int i = 0; i < n; i++) {
                g[i] = in.next();
            }
            if(n == 1) {
                out.println(1);
                return;
            }
            dp[0][0] = 1;
            for(int i = 1; i < n; i++) {
                if(g[i - 1].equals("f")) {
                    dp[1][0] = 0;
                    for(int j = 1; j < n; j++) {
                        dp[1][j] = dp[0][j - 1];
                    }
                }
                else {
                    dp[1][n - 1] = dp[0][n - 1];
                    for(int j = n - 2; j >= 0; j--) {
                        dp[1][j] = dp[1][j + 1] + dp[0][j];
                        dp[1][j] = dp[1][j] % modular;
                    }
                }
                for(int j = 0; j < n; j++) {
                    dp[0][j] = dp[1][j];
                }
                if(i == n - 1) {
                    for(int j = 0; j < n; j++) {
                        ans = ans + dp[1][j];
                        ans = ans % modular;
                    }
                }
            }
            out.println(ans);
        }
    }

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

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.*;
import java.util.*;

public final class PythonIndentation
{
	public static void main(String[] args)
	{
		new PythonIndentation(System.in, System.out);
	}

	static class Solver implements Runnable
	{
		static final int MOD = (int) 1e9 + 7;
		int n;
		char[] arr;
		long[][] dp;
		BufferedReader in;
		PrintWriter out;

		void solve() throws IOException
		{
			n = Integer.parseInt(in.readLine());
			arr = new char[n];
			dp = new long[n + 1][n + 1];

			for (int i = 0; i < n; i++)
				arr[i] = in.readLine().charAt(0);

			for (int i = 0; i <= n; i++)
				Arrays.fill(dp[i], -1);

			dp[0][0] = 1;

			if (arr[0] == 's')
				out.println(find(1, 0));
			else
				out.println(find(1, 1));
		}

		long find(int curr, int backIndents)
		{
			if (backIndents < 0)
				return 0;

			if (curr == n)
				return 1;

			if (dp[curr][backIndents] != -1)
				return dp[curr][backIndents];

			long ans;

			if (arr[curr] == 's')
				ans = find(curr + 1, backIndents);
			else
				ans = find(curr + 1, backIndents + 1);

			if (arr[curr - 1] != 'f')
				ans = CMath.mod(ans + find(curr, backIndents - 1), MOD);

			return dp[curr][backIndents] = ans;
		}

		public Solver(BufferedReader in, PrintWriter out)
		{
			this.in = in;
			this.out = out;
		}

		@Override public void run()
		{
			try
			{
				solve();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}
		}

	}

	static class CMath
	{
		static long mod(long number, long mod)
		{
			return number - (number / mod) * mod;
		}

	}

	private PythonIndentation(InputStream inputStream, OutputStream outputStream)
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
		PrintWriter out = new PrintWriter(outputStream);
		Thread thread = new Thread(null, new Solver(in, out), "PythonIndentation", 1 << 29);

		try
		{
			thread.start();
			thread.join();
		}
		catch (InterruptedException e)
		{
			e.printStackTrace();
		}
		finally
		{
			try
			{
				in.close();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}

			out.flush();
			out.close();
		}
	}

}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    BufferedReader br;
    PrintWriter pw;
    StringTokenizer st;
    long mod = (long) (1e9 + 7);

    public static void main(String[] args) {
        (new Main()).run();
    }

    void solve() throws IOException {
        int n = nextInt();
        boolean p[] = new boolean[n];
        for (int i = 0; i < n; i++) {
            String s = nextToken();
            if (s.charAt(0) == 'f') p[i] = true;
        }
        long d[][] = new long[n][n];
        d[0][0] = 1;
        for (int i = 1; i < n; i++) {
            if (p[i - 1]) {
                d[i][0] = 0;
                for (int j = 1; j < n; j++) {
                    d[i][j] = d[i - 1][j - 1];
                }
            } else {
                long sum = 0;
                for (int j = n - 1; j >= 0; j--) {
                    sum += d[i - 1][j];
                    sum %= mod;
                    d[i][j] = sum;
                }
            }
        }
        long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += d[n - 1][i];
            sum %= mod;
        }
        pw.print(sum);
    }

    void run() {
        try {
//            br = new BufferedReader(new FileReader("divljak.in"));
//            pw = new PrintWriter(new BufferedWriter(new FileWriter("divljak.out")));
//            br = new BufferedReader(new FileReader("input.txt"));
//            pw = new PrintWriter(new FileWriter("output.txt"));
            br = new BufferedReader(new InputStreamReader(System.in));
            pw = new PrintWriter(new OutputStreamWriter(System.out));

            solve();
            pw.close();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

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

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

    class h {
        int ans;
        int last;

        public h() {
            last = -1;
            ans = 0;
        }
    }
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C {


	static ArrayList<Integer> statements;
	static final int MOD = (int) 1e9 + 7;

	static int[][] memo;

	static int solve(int i, int c) {
		if(i == statements.size())
			return 1;
		if(memo[i][c] != -1)
			return memo[i][c];

		long ans = solve(i + 1, c + statements.get(i));
		if(c > 0)
			ans += solve(i, c - 1);
		return memo[i][c] = (int) (ans % MOD);

	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = sc.nextInt();
		statements = new ArrayList<>();

		char[] c = new char[n];
		for (int i = 0; i < n; i++) {
			c[i] = sc.next().charAt(0);
		}

		if(c[0] == 's')
			statements.add(0);
		else
			statements.add(1);

		for (int i = 1; i < n; i++) {
			if(c[i - 1] == 'f') {
				if(c[i] == 'f')
					statements.set(statements.size() - 1, statements.get(statements.size() - 1) + 1);
			}else {

				if(c[i] == 's')
					statements.add(0);
				else
					statements.add(1);
			}
		}


		memo = new int[statements.size()][n + 1];

		for(int[] a : memo)
			Arrays.fill(a, -1);
		out.println(solve(0, 0));
		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(String file) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}
}
// 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.Arrays;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStream;

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

    static class TaskC {
        private final int MOD = (int) (1e9 + 7);

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            String[] arr = new String[n];
            for (int i = 0; i < n; i++) {
                arr[i] = in.nextString();
            }
            int[] dp = new int[n];
            Arrays.parallelSetAll(dp, i -> 0);
            dp[0] = 1;
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                if (arr[i].equals("f")) {
                    cnt++;
                    continue;
                }
                calc(dp, n, cnt);
                cnt = 0;
            }
            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += dp[i];
                sum %= MOD;
            }
            out.println(sum);
        }

        private void calc(int[] dp, int n, int cnt) {
            for (int i = n - 1; i >= 0; i--) {
                if (i != n - 1) dp[i] += dp[i + 1];
                dp[i] %= MOD;
            }
            int[] tmp = new int[n];
            for (int i = 0; i < n; i++) {
                tmp[(i + cnt) % n] = dp[i];
            }
            Arrays.parallelSetAll(dp, i -> tmp[i]);
        }

    }

    static class FastScanner {
        private BufferedReader br;
        private StringTokenizer st;

        public FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        public FastScanner(InputStream f) {
            br = new BufferedReader(new InputStreamReader(f));
        }

        public String nextString() {
            while (st == null || !st.hasMoreTokens()) {
                String s = null;
                try {
                    s = br.readLine();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (s == null)
                    return null;
                st = new StringTokenizer(s);
            }
            return st.nextToken();
        }

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

    }
}
// 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.Arrays;
import java.util.Scanner;

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

    static class TaskC {
        private static final int MOD = (int) 1e9 + 7;
        private static final int N = 5000;

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] dp = new int[N];
            Arrays.fill(dp, 0);
            dp[0] = 1;
            String pre = null, ch;
            for (int i = 0; i < n; ++i) {
                ch = in.next();
                if (i > 0) {
                    if (pre.equals("s")) {
                        int j = N - 1;
                        while (dp[j] == 0) {
                            --j;
                        }
                        long sum = 0;
                        for (; j >= 0; --j) {
                            sum += dp[j];
                            sum %= MOD;
                            dp[j] = (int) sum;
                        }
                    } else {
                        for (int k = N - 1; k > 0; --k) {
                            dp[k] = dp[k - 1];
                        }
                        dp[0] = 0;
                    }
                }
                pre = ch;
            }

            long sum = 0;
            for (int i = 0; i < N; ++i) {
                sum += dp[i];
                sum %= MOD;
            }
            out.println(sum);
        }

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

public class p3sol{

	static char[] c;
	static int[][] dp;
	static int mod = (int)1e9 + 7;

	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		c = new char[n];

		for(int i = 0; i < n; i++)
			c[i] = br.readLine().charAt(0);

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

		dp[0][0] = 1;

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

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

		// print(dp);

		System.out.println(ans);
		
		br.close();
	}

	public static void print(int[][] a){
		for(int i = 0; i < a.length; i++){
			for(int j = 0; j < a[0].length; j++)
				System.out.print(a[i][j] + " ");
			System.out.println("");
		}
	}

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

public class GFG {
    static int count=0;
    
	public static void main (String[] args) {
		Scanner ob=new Scanner(System.in);
		int n;
		long MOD=(long)(1e9+7);
		int f=0,s=0;
		n=ob.nextInt();
		long dp[][]=new long[n+2][n+2];
		dp[0][1]=1;
		char ch='s';
		char p;
		for(int i=1;i<=n;i++)
		{
		    p=ch;
		    ch=ob.next().charAt(0);
		    if(p=='f')
		    {
		        for(int j=1;j<=n;j++)
		        dp[i][j+1]=dp[i-1][j];
		    }
		    else
		    {
		        for(int j=n;j>0;j--)
		        {
		            dp[i][j]=(dp[i][j+1]+dp[i-1][j])%MOD;
		        }
		    }
		}
		
		long ans=0;
		
		for(int i=1;i<=n;i++)
		{
		    ans=(ans+dp[n][i])%MOD;
		}
		System.out.println(ans);
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.awt.*;
import java.io.*;
import java.math.*;
import java.util.*;
 
 
public class TaskC {
	
	public static void main(String[] args) {
		new TaskC().run();
	}
	
	void solve(){
		int n = in.nextInt();
		String s[] = new String[n];
		for(int i = 0; i < n; i++) s[i] = in.next();
		if(s[n-1].compareTo("f") == 0){
			out.println(0);
			return;
		}
		int dp[] = new int[n+2];
		int mod = 1000*1000*1000+7;
		dp[0] = 1;
		for(int i = n-1; i >= 0; i--){	
			if(s[i].compareTo("s") == 0){
				int ss = 0;
				for(int j = 0; j <= n; j++){
					ss += dp[j];
					if(ss>=mod) ss -= mod;
					dp[j] = ss;
				}
			}else{
				for(int j = 0; j < n;j++){
					dp[j] = dp[j+1];
				}
				dp[n] = 0;
			}
		}
		out.println(dp[0]);
	}

	
	FastScanner in;
	PrintWriter out;
	void run() {
		in = new FastScanner(System.in);
		out = new PrintWriter(System.out);
		int tests = 1;//in.nextInt();
		while(tests > 0){
			solve();
			tests--;
		}
		out.close();
	}
	
	class Pair implements Comparable<Pair>{
		Integer x, y;
		public Pair(int x, int y){
			this.x = x;
			this.y = y;
		}
		@Override
		public int compareTo(Pair o) {
			if(x.compareTo(o.x) == 0) return y.compareTo(o.y);
			return x.compareTo(o.x);
		}
		
	}
 
	class FastScanner {
		StringTokenizer st;
		BufferedReader bf;
 
		public FastScanner(InputStream is) {
			bf = new BufferedReader(new InputStreamReader(is));
		}
 
		public FastScanner(File f){
			try{
				bf = new BufferedReader(new FileReader(f));
			}
			catch(IOException ex){
				ex.printStackTrace();
			}
		}
		String next(){
			while(st == null || !st.hasMoreTokens()){
				try{
					st = new StringTokenizer(bf.readLine());
				}
				catch(Exception ex){
					ex.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		int[] readArray(int n){
			int[] a = new int[n];
			for(int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}
	}
 
}
// 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.io.PrintStream;
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 Wolfgang Beyer
 */
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 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long MOD = 1000000007;

            long[] current = new long[n + 3];
            //long[] sum = new long[n + 3];
            current[0] = 1;

            for (int i = 0; i < n - 1; i++) {

                String s = in.next();
                if (s.equals("f")) {
                    for (int j = i + 1; j > 0; j--) {
                        current[j] = current[j - 1];
                        current[j] %= MOD;
                    }
                    current[0] = 0;
                } else {
                    for (int j = i + 1; j >= 0; j--) {
                        //sum[j] = sum[j + 1] + current[j];
                        current[j] = current[j + 1] + current[j];
                        current[j] %= MOD;
                    }
                    //for (int j = 0; j <= i + 1; j++) {
                    //  current[j] =
                    //}
                }
            }
            long result = 0;
            for (int i = 0; i <= n; i++) {
                result += current[i];
                result %= MOD;
            }
            out.println(result);
        }

    }

    static class InputReader {
        private static BufferedReader in;
        private static StringTokenizer tok;

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

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

        public String next() {
            try {
                while (tok == null || !tok.hasMoreTokens()) {
                    tok = new StringTokenizer(in.readLine());
                    //tok = new StringTokenizer(in.readLine(), ", \t\n\r\f"); //adds commas as delimeter
                }
            } catch (IOException ex) {
                System.err.println("An IOException was caught :" + ex.getMessage());
            }
            return tok.nextToken();
        }

    }
}