import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class C {

	//why am I MLE'ing???

	int n;
	char[] a;
	long[][] memo;
	long mod = (long) 1e9 + 7;

	boolean lastFor(int i) {
		if(i == 0) return false;
		return a[i - 1] == 'f';
	}

	long dp(int ind, int curIndent) {
		if(ind == n) return 1;
		if(curIndent < 0) return 0;
		if(memo[ind][curIndent] != -1) return memo[ind][curIndent];
		long ans = 0;
		if(a[ind] == 'f' && lastFor(ind)) {
			ans += dp(ind + 1, curIndent + 1);
		} else if(a[ind] == 'f' && !lastFor(ind)) {
			ans += dp(ind, curIndent - 1);
			ans += dp(ind + 1, curIndent + 1);
//			for(int indent = 1; indent <= curIndent + 1; ++indent) {
//				ans += dp(ind + 1, indent);
//			}
		} else if(a[ind] == 's' && lastFor(ind)) {
			ans += dp(ind + 1, curIndent);
		} else if(a[ind] == 's' && !lastFor(ind)) {
			ans += dp(ind + 1, curIndent);
			ans += dp(ind, curIndent - 1);
//			for(int indent = 0; indent <= curIndent; ++indent) {
//				ans += dp(ind + 1, indent);
//			}
		}
		return memo[ind][curIndent] = ans % mod;
	}

	public void solve(Scanner in, PrintWriter out) {
		n = in.nextInt();
		a = new char[n];
		int forCount = 0;
		int[] fc = new int[n + 1];
		for(int i = 0; i < n; ++i) {
			a[i] = in.next().charAt(0);
			if(a[i] == 'f') ++forCount;
			fc[i] = forCount;
		}
		fc[n] = fc[n - 1];
//		long time = System.currentTimeMillis();
		memo = new long[n][forCount + 1];
		for(long[] aa : memo) {
			Arrays.fill(aa, -1);
		}
		for(int i = n; i >= 0; --i) {
			for(int indent = fc[i] - 1; indent >= 0; --indent) {
				dp(i, indent);
			}
		}
		out.println(dp(0, 0) % mod);
//		System.out.println(System.currentTimeMillis() - time);
	}

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

		new C().solve(in, out);

		in.close();
		out.close();
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ankur
 */
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 {
        long mod = (long) 1e9 + 7;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            char ar[] = new char[n];
            for (int i = 0; i < n; i++) {
                ar[i] = in.readString().charAt(0);
            }
            long dp[][] = new long[n + 1][n + 1];
            for (int i = 0; i < n; i++) {
                dp[n - 1][i] = 1;
            }
            long prev = n;
            for (int i = n - 2; i >= 0; i--) {
                if (ar[i] == 'f') {
                    if (ar[i + 1] == 's') {
                        for (int j = n - 2; j >= 0; j--) {
                            dp[i][j] = dp[i + 1][j + 1];
                        }
                    } else {
                        for (int j = n - 2; j >= 0; j--) {
                            dp[i][j] = dp[i + 1][j + 1];
                        }

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

        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            //*-*------clare------

            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}


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());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskC {
        static final long MODULO = (long) (1e9 + 7);

        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            long[][] dp = new long[n + 100][n + 100];
            dp[0][0] = 1;
            for (int i = 0; i < n; ++i) {
                char current = in.nextCharacter();
                if (current == 'f') {
                    for (int j = 0; j < n; ++j) {
                        //our only option is to go 1 depth deeper
                        dp[i + 1][j + 1] += dp[i][j];
                        dp[i + 1][j + 1] %= MODULO;
                    }
                } else {
                    long runningSum = 0;
                    for (int j = n; j >= 0; --j) {
                        // for each j all preceding depths are possible
                        // can also implement partial sum to improve
                        // time complexity to dpeth * n only(affect only if no. of f are less than n s
                        runningSum += dp[i][j];
                        runningSum %= MODULO;

                        dp[i + 1][j] += runningSum;
                        dp[i + 1][j] %= MODULO;
                    }
                }
            }
            out.println(dp[n][0]);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public char nextCharacter() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            return (char) c;
        }

    }
}


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

    }
}


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


import java.io.*;
import java.util.*;
import  java.math.*;
public class Main {

	public static void main(String[] args) throws IOException
	{
		// StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		FastScanner sc = new FastScanner();
		int dp[][]=new int[6000][6000];
		char a[]=new char[6000];
		final int n=sc.nextInt();
		boolean flag=false;
		int cnt=0;
		char pre='f';
		for(int i=1;i<=n;i++)
		{
			 a[i]=sc.next().charAt(0);

		}
		dp[1][1]=1;
		final int mod=(int)1e9+7;
		dp[1][1]=1;
		for(int i=2;i<=n;i++)
		{
			if(a[i-1]=='s')
			{
				int now=0;
				for(int j=5050;j>=1;j--)
				{
					now=(now+dp[i-1][j])%mod;
					dp[i][j]=now;
				}
			}
			else
			{
				for(int j=5050;j>=1;j--)
				{
					dp[i][j]=dp[i-1][j-1]%mod;
				}
			}
		}
		int ans=0;
		for(int i=0;i<=5050;i++)
		{
			ans+= dp[n][i]%mod;
			ans%=mod;
		}
		out.println(ans%mod);

		out.flush();
	}
/*
6
f
s
f
s
f
s

	 */
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;
		private FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}
		private boolean hasNextToken()
		{
			if(st.countTokens()!=StreamTokenizer.TT_EOF)
			{
				return true;
			}
			else
				return false;
		}
		private String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}
		private BigInteger nextBigInteger(){return new BigInteger(next());}
		private BigDecimal nextBigDecimal(){return new BigDecimal(next());}
		private  int nextInt() {return Integer.parseInt(next());}
		private long nextLong() {return Long.parseLong(next());}
		private double nextDouble() {return Double.parseDouble(next());}
		private String nextLine() {
			String line = "";
			if(st.hasMoreTokens()) line = st.nextToken();
			else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
			while(st.hasMoreTokens()) line += " "+st.nextToken();
			return line;
		}
		private int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
		private long[] nextLongArray(int n){
			long[] a = new long[n];
			for(int i = 0; i < n; i++) a[i] = nextLong();
			return a;
		}
		private double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}
		private char[][] nextGrid(int n, int m){
			char[][] grid = new char[n][m];
			for(int i = 0; i < n; i++) grid[i] = next().toCharArray();
			return grid;
		}
		private void sort(int arr[])
		{
			int cnt[]=new int[(1<<16)+1];
			int ys[]=new int[arr.length];
			for(int j=0;j<=16;j+=16){
				Arrays.fill(cnt,0);
				for(int x:arr){cnt[(x>>j&0xFFFF)+1]++;}
				for(int i=1;i<cnt.length;i++){cnt[i]+=cnt[i-1];}
				for(int x:arr){ys[cnt[x>>j&0xFFFF]++]=x;}
				{ final int t[]=arr;arr=ys;ys=t;}
			}
			if(arr[0]<0||arr[arr.length-1]>=0)return;
			int i,j,c;
			for(i=arr.length-1,c=0;arr[i]<0;i--,c++){ys[c]=arr[i];}
			for(j=arr.length-1;i>=0;i--,j--){arr[j]=arr[i];}
			for(i=c-1;i>=0;i--){arr[i]=ys[c-1-i];}
		}
	}

}


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];
            int prev = dp[0];
            for (int i = 0, y = 0; i < MathUtil.gcdInt(n, cnt); i++) {
                //tmp[(i+cnt)%n] = dp[i];
                y = i;
                prev = dp[i];
                do {
                    int nextId = (y + cnt) % n;
                    int tmp = dp[nextId];
                    dp[nextId] = prev;
                    prev = tmp;
                    y = nextId;
                } while (y != 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());
        }

    }

    static class MathUtil {
        public static int gcdInt(int a, int b) {
            if (b == 0) return a;
            return gcdInt(b, a % b);
        }

    }
}


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());
    }
  }
}


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();
        }

    }
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class PythonIndentiation {
	PrintWriter pw = new PrintWriter(System.out);
	final static boolean debugmode = true;
	public static int k = 7; // for 10^9 + k mods.
	public static int STMOD = 1000000000 + k; // 10^9 + k
	public static Reader sc = new Reader();

	public static void main(String[] args) throws IOException {
		int commands = sc.nextInt();
		int[][] dp = new int[5000][5000];
		int interesting = 0;
		String prgm = "";
		while (interesting < commands){
			byte q = sc.read();
			if (q == 115 ){
				interesting += 1;
				prgm += "s";
			}
			else if (q == 102){
				prgm += "f";
				interesting += 1;
			}
		}
		//System.out.println("Program: "+prgm);
		dp[0][0] = 1; // line, indentations
		for(int line = 1;line<commands;line++){
			if(prgm.charAt(line-1) == 'f'){
				for(int indent  = 1;indent<Math.min(2*line + 1, 5000);indent++){
					dp[line][indent] = dp[line-1][indent-1];
				}
			}
			else if(prgm.charAt(line-1) == 's'){
				int w = 0;
				for(int indent = Math.min(2*line + 1, 4999);indent >= 0;indent--){
					w = (w + dp[line-1][indent])% STMOD;

					dp[line][indent] = w ;
				}
			}
		}
		int q = 0;
		for(int i = 0;i<5000;i++){
			q  = ( q + dp[commands-1][i] ) % STMOD;
		}
		System.out.println(q);

	}
	public static String parseIt(int commands) throws IOException{
		String c = "";
		System.out.println(sc.read());
		return c;
	}
	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

}


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());
        }

}


import java.io.*;
import java.util.*;

public class Solution {

    public static void main(String[] args) throws Exception {
        MyReader reader = new MyReader(System.in);
//        MyReader reader = new MyReader(new FileInputStream("input.txt"));
        MyWriter writer = new MyWriter(System.out);
        new Solution().run(reader, writer);
        writer.close();
    }

    private void run(MyReader reader, MyWriter writer) throws IOException, InterruptedException {
        int n = reader.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = reader.nextString().charAt(0);
        }
        long[][] d = new long[n + 1][n + 1];
        d[0][0] = 1;
        long mod = 1_000_000_007;
        for (int i = 1; i < n; i++) {
            for (int j = n - 1; j >= 0; j--) {
                if (a[i - 1] == 'f') {
                    d[i][j + 1] = d[i - 1][j];
                } else {
                    d[i][j] = (d[i - 1][j] + d[i][j + 1]) % mod;
                }
            }
        }
        long ans = 0;
        for (int i = 0; i <= n; i++) {
            ans += d[n - 1][i];
        }
        writer.print(ans % mod);
    }

    static class MyReader {

        final BufferedInputStream in;
        final int bufSize = 1 << 16;
        final byte buf[] = new byte[bufSize];
        int i = bufSize;
        int k = bufSize;
        boolean end = false;
        final StringBuilder str = new StringBuilder();

        MyReader(InputStream in) {
            this.in = new BufferedInputStream(in, bufSize);
        }

        int nextInt() throws IOException {
            return (int) nextLong();
        }

        int[] nextIntArray(int n) throws IOException {
            int[] m = new int[n];
            for (int i = 0; i < n; i++) {
                m[i] = nextInt();
            }
            return m;
        }

        int[][] nextIntMatrix(int n, int m) throws IOException {
            int[][] a = new int[n][0];
            for (int j = 0; j < n; j++) {
                a[j] = nextIntArray(m);
            }
            return a;
        }

        long nextLong() throws IOException {
            int c;
            long x = 0;
            boolean sign = true;
            while ((c = nextChar()) <= 32) ;
            if (c == '-') {
                sign = false;
                c = nextChar();
            }
            if (c == '+') {
                c = nextChar();
            }
            while (c >= '0') {
                x = x * 10 + (c - '0');
                c = nextChar();
            }
            return sign ? x : -x;
        }

        long[] nextLongArray(int n) throws IOException {
            long[] m = new long[n];
            for (int i = 0; i < n; i++) {
                m[i] = nextLong();
            }
            return m;
        }

        int nextChar() throws IOException {
            if (i == k) {
                k = in.read(buf, 0, bufSize);
                i = 0;
            }
            return i >= k ? -1 : buf[i++];
        }

        String nextString() throws IOException {
            if (end) {
                return null;
            }
            str.setLength(0);
            int c;
            while ((c = nextChar()) <= 32 && c != -1) ;
            if (c == -1) {
                end = true;
                return null;
            }
            while (c > 32) {
                str.append((char) c);
                c = nextChar();
            }
            return str.toString();
        }

        String nextLine() throws IOException {
            if (end) {
                return null;
            }
            str.setLength(0);
            int c = nextChar();
            while (c != '\n' && c != '\r' && c != -1) {
                str.append((char) c);
                c = nextChar();
            }
            if (c == -1) {
                end = true;
                if (str.length() == 0) {
                    return null;
                }
            }
            if (c == '\r') {
                nextChar();
            }
            return str.toString();
        }

        char[] nextCharArray() throws IOException {
            return nextString().toCharArray();
        }

        char[][] nextCharMatrix(int n) throws IOException {
            char[][] a = new char[n][0];
            for (int i = 0; i < n; i++) {
                a[i] = nextCharArray();
            }
            return a;
        }
    }

    static class MyWriter {

        final BufferedOutputStream out;
        final int bufSize = 1 << 16;
        final byte buf[] = new byte[bufSize];
        int i = 0;
        final byte c[] = new byte[30];
        static final String newLine = System.getProperty("line.separator");

        MyWriter(OutputStream out) {
            this.out = new BufferedOutputStream(out, bufSize);
        }

        void print(long x) throws IOException {
            int j = 0;
            if (i + 30 >= bufSize) {
                flush();
            }
            if (x < 0) {
                buf[i++] = (byte) ('-');
                x = -x;
            }
            while (j == 0 || x != 0) {
                c[j++] = (byte) (x % 10 + '0');
                x /= 10;
            }
            while (j-- > 0)
                buf[i++] = c[j];
        }

        void print(int[] m) throws IOException {
            for (int a : m) {
                print(a);
                print(' ');
            }
        }

        void print(long[] m) throws IOException {
            for (long a : m) {
                print(a);
                print(' ');
            }
        }

        void print(String s) throws IOException {
            for (int i = 0; i < s.length(); i++) {
                print(s.charAt(i));
            }
        }

        void print(char x) throws IOException {
            if (i == bufSize) {
                flush();
            }
            buf[i++] = (byte) x;
        }

        void print(char[] m) throws IOException {
            for (char c : m) {
                print(c);
            }
        }

        void println(String s) throws IOException {
            print(s);
            println();
        }

        void println() throws IOException {
            print(newLine);
        }

        void flush() throws IOException {
            out.write(buf, 0, i);
            out.flush();
            i = 0;
        }

        void close() throws IOException {
            flush();
            out.close();
        }
    }
}


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


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]);
	}
}


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


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


import java.util.Optional;
import java.util.Scanner;

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

	private void solveA() {
		Scanner sc = new Scanner(System.in);
		String first = sc.next();
		String last = sc.next();
		String answer = first.substring(0, 1) + last.substring(0, 1);
		for (int i = 2; i <= first.length(); i++) {
			String current = first.substring(0, i) + last.substring(0, 1);
			if (answer.compareTo(current) > 0) {
				answer = current;
			}
		}
		System.out.println(answer);
	}

	private void solveB() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int layer = 0;
		for (int i = 1; i <= N; i++) {
			int max = N - i + 1;
			layer += i < max ? i : max;
		}
		System.out.println(layer);
	}

	private void solveC() {
		Scanner sc = new Scanner(System.in);
		final long MOD_NUM = 1000000007L;
		int N = sc.nextInt();
		long[] level = new long[N + 2];
		level[0] = 1;
		sc.nextLine();
		String pre = "s";
		for (int i = 0; i < N; i++) {
			String line = sc.nextLine();
			long[] next_level = new long[N + 2];
			if (pre.equals("f")) {
				for (int j = 1; j < N + 1; j++) {
					next_level[j] = level[j - 1];
				}
			}
			if (pre.equals("s")) {
				for (int j = N; j >= 0; j--) {
					next_level[j] = (next_level[j + 1] + level[j]) % MOD_NUM;
				}
			}
			pre = line;
			level = next_level;
		}
		long answer = 0L;
		for (int i = 0; i < N + 1; i++) {
			answer = (answer + level[i]) % MOD_NUM;
		}
		System.out.println(answer);
	}

	private void solveD() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveE() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	private void solveF() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		System.out.println(N);
	}

	interface Graph {
		void link(int from, int to, long cost);
		Optional<Long> getCost(int from, int to);
		int getVertexNum();
	}

	interface FlowResolver {
		long maxFlow(int from, int to);
	}

	/**
	 * グラフの行列による実装
	 * 接点数の大きいグラフで使うとMLEで死にそう
	 */
	class ArrayGraph implements Graph {
		private Long[][] costArray;
		private int vertexNum;

		public ArrayGraph(int n) {
			costArray = new Long[n][];
			for (int i = 0; i < n; i++) {
				costArray[i] = new Long[n];
			}
			vertexNum = n;
		}

		@Override
		public void link(int from, int to, long cost) {
			costArray[from][to] = new Long(cost);
		}

		@Override
		public Optional<Long> getCost(int from, int to) {
			return Optional.ofNullable(costArray[from][to]);
		}

		@Override
		public int getVertexNum() {
			return vertexNum;
		}
	}

	/**
	 * DFS(深さ優先探索)による実装
	 * 計算量はO(E*MaxFlow)のはず (E:辺の数, MaxFlow:最大フロー)
	 */
	class DfsFlowResolver implements FlowResolver {
		private Graph graph;
		public DfsFlowResolver(Graph graph) {
			this.graph = graph;
		}

		/**
		 * 最大フロー(最小カット)を求める
		 * @param from 始点(source)のID
		 * @param to 終点(target)のID
		 * @return 最大フロー(最小カット)
		 */
		public long maxFlow(int from, int to) {
			long sum = 0L;
			long currentFlow;
			do {
				currentFlow = flow(from, to, Long.MAX_VALUE / 3, new boolean[graph.getVertexNum()]);
				sum += currentFlow;
			} while (currentFlow > 0);
			return sum;
		}

		/**
		 * フローの実行 グラフの更新も行う
		 * @param from 現在いる節点のID
		 * @param to 終点(target)のID
		 * @param current_flow ここまでの流量
		 * @param passed 既に通った節点か否かを格納した配列
		 * @return 終点(target)に流した流量/戻りのグラフの流量
		 */
		private long flow(int from, int to, long current_flow, boolean[] passed) {
			passed[from] = true;
			if (from == to) {
				return current_flow;
			}
			for (int id = 0; id < graph.getVertexNum(); id++) {
				if (passed[id]) {
					continue;
				}
				Optional<Long> cost = graph.getCost(from, id);
				if (cost.orElse(0L) > 0) {
					long nextFlow = current_flow < cost.get() ? current_flow : cost.get();
					long returnFlow = flow(id, to, nextFlow, passed);
					if (returnFlow > 0) {
						graph.link(from, id, cost.get() - returnFlow);
						graph.link(id, from, graph.getCost(id, from).orElse(0L) + returnFlow);
						return returnFlow;
					}
				}
			}
			return 0L;
		}
	}

	/**
	 * 1-indexedのBIT配列
	 */
	class BinaryIndexedTree {
		private long[] array;

		public BinaryIndexedTree(int size) {
			this.array = new long[size + 1];
		}

		/**
		 * 指定した要素に値を加算する
		 * 計算量はO(logN)
		 * @param index 加算する要素の添字
		 * @param value 加算する量
		 */
		public void add(int index, long value) {
			for (int i = index; i < array.length; i += (i & -i)) {
				array[i] += value;
			}
		}

		/**
		 * 1〜指定した要素までの和を取得する
		 * 計算量はO(logN)
		 * @param index 和の終端
		 * @return 1〜indexまでの和
		 */
		public long getSum(int index) {
			long sum = 0L;
			for (int i = index; i > 0; i -= (i & -i)) {
				sum += array[i];
			}
			return sum;
		}
	}
}


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]);
       }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
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;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C909 solver = new C909();
        solver.solve(1, in, out);
        out.close();
    }

    static class C909 {
        int N;
        long MOD = 1_000_000_007;
        boolean[] type;
        long[][] memo;

        long dp(int cmd, int dep) {
            // safe if we came out of a statement, we can traverse
            if (dep < 0) return 0;
            if (cmd == N) return 1;
            if (memo[cmd][dep] != -1) return memo[cmd][dep];

            boolean safe = cmd == 0 ? true : !type[cmd - 1];
            int d = type[cmd] ? 1 : 0;

            long ways = 0;
            if (!safe) {
                // we must use this indentation
                ways += dp(cmd + 1, dep + d);
                ways %= MOD;
            } else {
                ways += dp(cmd + 1, dep + d);
                ways %= MOD;
                ways += dp(cmd, dep - 1);
                ways %= MOD;
            }

            return memo[cmd][dep] = ways;
        }

        public void solve(int testNumber, FastScanner s, PrintWriter out) {
            N = s.nextInt();
            type = new boolean[N];
            for (int i = 0; i < N; i++) {
                type[i] = s.next().charAt(0) == 'f';
            }

            memo = new long[N][N + 1];
            for (long[] a : memo)
                Arrays.fill(a, -1);

            out.println(dp(0, 0));

        }

    }

    static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

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

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

    }
}


import java.io.*;
import java.util.*;

public class Solution {

    static MyScanner sc;
    private static PrintWriter out;
    static long M2 = 1_000_000_000L + 7;

    private static HashMap<Long, Long>[] mods;

    public static void main(String[] s) throws Exception {
        StringBuilder stringBuilder = new StringBuilder();

//        stringBuilder.append("7 3\n" +
//                "1 5 2 6 3 7 4\n" +
//                "2 5 3\n" +
//                "4 4 1\n" +
//                "1 7 3");

//
//        Random r = new Random(5);
//        stringBuilder.append("100000 5000 ");
//        for (int i = 0; i < 100000; i++) {
//            stringBuilder.append(" " + (r.nextInt(2000000000) - 1000000000) + " ");
//
//        }
//        for (int k = 0; k < 5000; k++) {
//            stringBuilder.append(" 1 100000 777 ");
//        }

        if (stringBuilder.length() == 0) {
            sc = new MyScanner(System.in);
        } else {
            sc = new MyScanner(new BufferedReader(new StringReader(stringBuilder.toString())));
        }

        out = new PrintWriter(new OutputStreamWriter(System.out));

        initData();
        solve();

        out.flush();
    }

    private static void solve() throws IOException {
        int n = sc.nextInt();
        boolean[] k = new boolean[n];

        for (int r = 0; r < n; r++) {
            k[r] = sc.next().charAt(0) == 'f';
        }
        if (k[n - 1]) {
            out.println(0);
            return;
        }
        long[][] res = new long[n + 1][n + 1];
        res[0][0] = 1;
        for (int t = 0; t < n; t++) {

            boolean pl = t != 0 && k[t - 1];
            if (pl) {
                System.arraycopy(res[t], 0, res[t + 1], 1, n);
            } else {
                long last = 0;
                for (int f = n; f >= 0; f--) {
                    last += res[t][f];
                    last %= M2;
                    res[t + 1][f] = last;
                }
            }
        }
        long pp = 0;
        for (long kk : res[n]) {
            pp += kk;
            pp %= M2;
        }
        out.println(pp);
    }

    private static void initData() {

    }

    static char[][] data;
    static String cmd;

    private static final class STree {
        private final Comparator<Integer> comparator;
        int[] val1;
        int[] from1;
        int[] to1;
        int[] max1;

        public STree(int c, Comparator<Integer> comparator) {
            this.comparator = comparator;
            int size = Integer.highestOneBit(c);
            if (size != c) {
                size <<= 1;
            }
            int rs = size << 1;
            val1 = new int[rs];
            from1 = new int[rs];
            max1 = new int[rs];
            to1 = new int[rs];

            Arrays.fill(from1, Integer.MAX_VALUE);
            for (int r = rs - 1; r > 1; r--) {
                if (r >= size) {
                    from1[r] = r - size;
                    to1[r] = r - size;
                }
                from1[r / 2] = Math.min(from1[r / 2], from1[r]);
                to1[r / 2] = Math.max(to1[r / 2], to1[r]);
            }
        }

        public int max(int from, int to) {
            return max(1, from, to);
        }

        private int max(int cur, int from, int to) {
            if (cur >= val1.length) return -1;
            if (from <= from1[cur] && to1[cur] <= to) {
                return max1[cur];
            }
            if (from1[cur] > to || from > to1[cur]) {
                return -1;
            }
            cur <<= 1;

            return max0(max(cur, from, to), max(cur + 1, from, to));
        }

        public void put(int x, int val) {
            x += val1.length >> 1;
            val1[x] = val;
            max1[x] = val;
            addToParent(x);
        }

        private void addToParent(int cur) {
            while (cur > 1) {
                cur >>= 1;
                max1[cur] = max0(max1[cur << 1], max1[1 + (cur << 1)]);
            }
        }

        private int max0(int i, int i1) {
            if (i == -1) return i1;
            if (i1 == -1) return i;
            return comparator.compare(i, i1) > 0 ? i1 : i;
        }
    }

    private static boolean isset(long i, int k) {
        return (i & (1 << k)) > 0;
    }

    private static void solveT() throws IOException {
        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
    }

    private static long gcd(long l, long l1) {
        if (l > l1) return gcd(l1, l);
        if (l == 0) return l1;
        return gcd(l1 % l, l);
    }

    private static long pow(long a, long b, long m) {
        if (b == 0) return 1;
        if (b == 1) return a;
        long pp = pow(a, b / 2, m);
        pp *= pp;
        pp %= m;
        return (pp * (b % 2 == 0 ? 1 : a)) % m;
    }

    static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        MyScanner(BufferedReader br) {
            this.br = br;
        }

        public MyScanner(InputStream in) {
            this(new BufferedReader(new InputStreamReader(in)));
        }

        void findToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        String next() {
            findToken();
            return st.nextToken();
        }

        Integer[] nab(int n) {
            Integer[] k = new Integer[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.fi();
            }
            return k;
        }

        int[] na(int n) {
            int[] k = new int[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.fi();
            }
            return k;
        }

        long[] nl(int n) {
            long[] k = new long[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.nextLong();
            }
            return k;
        }

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

        int fi() {
            String t = next();
            int cur = 0;
            boolean n = t.charAt(0) == '-';
            for (int a = n ? 1 : 0; a < t.length(); a++) {
                cur = cur * 10 + t.charAt(a) - '0';
            }
            return n ? -cur : cur;
        }

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

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

}


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();
	}
}


import java.util.*;
import java.text.*;
import java.io.*;
import java.math.*;
public class code5 {
	InputStream is;
	PrintWriter out;
	static long mod=pow(10,9)+7;
	static int dx[]={0,0,1,-1},dy[]={1,-1,0,0};
	String arr[];
	long dp[][];
	void solve() throws IOException
	{
		int n=ni();
		arr=new String[n];
		for(int i=0;i<n;i++)
			arr[i]=ns();
		dp=new long[n+1][n+1];
		dp[0][0]=1;
		for(int i=0;i<n;i++)
		{
			long next[]=new long[n+1];
			for(int j=0;j<=i;j++)
			{
				if(arr[i].charAt(0)=='s')
				{
					next[0]+=dp[i][j];
					next[j+1]-=dp[i][j];
				}else {
					next[j+1]+=dp[i][j];
					next[j+2]-=dp[i][j];
				}
			}
			long count=0;
			for(int j=0;j<n;j++)
			{
				count+=next[j];
				count=(count+mod)%mod;
				dp[i+1][j]=count;
			}
		}
		long ans=0;
		for(int i=0;i<n;i++)
		{
			ans+=dp[n-1][i];
			ans%=mod;
		}
		out.print(ans);
	}
	long rec(int index,int level)
	{
		if(index>=arr.length-1)
			return 1;
		if(dp[index][level]!=-1)
			return dp[index][level];
		dp[index][level]=0;
		if(arr[index].charAt(0)=='s')
		{
			dp[index][level]+=rec(index+1,level);
			dp[index][level]%=mod;
			if(level>0)
			{
				dp[index][level]+=rec(index+1,0);
				dp[index][level]%=mod;
			}
		}
		else {
			dp[index][level]+=rec(index+1,level+1);
			dp[index][level]%=mod;
		}
		return dp[index][level];
	}
	double a[],b[],p;
	int sum(int i)
	{
		int sum=0;
		while(i!=0)
		{
			if((i%10)%2==1)
				sum+=i%10;
			i/=10;
		}
		return sum;
	}
	ArrayList<Integer> al[];
 	void take(int n,int m)
 	{
 		al=new ArrayList[n];
 		for(int i=0;i<n;i++)
 			al[i]=new ArrayList<Integer>();
 		for(int i=0;i<m;i++)
 		{
 			int x=ni()-1;
 			int y=ni()-1;
 			al[x].add(y);
 			al[y].add(x);
 		}
 	}
 	int check(long n)
 	{
 		int count=0;
 		while(n!=0)
 		{
 			if(n%10!=0)
 				break;
 			n/=10;
 			count++;
 		}
 		return count;
 	}
	public static int count(int x)
	{
		int num=0;
		while(x!=0)
		{
			x=x&(x-1);
			num++;
		}
		return num;
	}
	static long d, x, y;
	void extendedEuclid(long A, long B) {
	    if(B == 0) {
	        d = A;
	        x = 1;
	        y = 0;
	    }
	    else {
	        extendedEuclid(B, A%B);
	        long temp = x;
	        x = y;
	        y = temp - (A/B)*y;
	    }
	}
	long modInverse(long A,long M) //A and M are coprime
	{
	    extendedEuclid(A,M);
	    return (x%M+M)%M;    //x may be negative
	}
	public static void mergeSort(int[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(int arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		int left[] = new int[n1];
		int right[] = new int[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	public static void mergeSort(long[] arr, int l ,int r){
		if((r-l)>=1){
			int mid = (l+r)/2;
			mergeSort(arr,l,mid);
			mergeSort(arr,mid+1,r);
			merge(arr,l,r,mid);
		}
	}
	public static void merge(long arr[], int l, int r, int mid){
		int n1 = (mid-l+1), n2 = (r-mid);
		long left[] = new long[n1];
		long right[] = new long[n2];
		for(int i =0 ;i<n1;i++) left[i] = arr[l+i];
		for(int i =0 ;i<n2;i++) right[i] = arr[mid+1+i];
		int i =0, j =0, k = l;
		while(i<n1 && j<n2){
			if(left[i]>right[j]){
				arr[k++] = right[j++];
			}
			else{
				arr[k++] = left[i++];
			}
		}
		while(i<n1) arr[k++] = left[i++];
		while(j<n2) arr[k++] = right[j++];
	}
	 static class Pair implements Comparable<Pair>{

	       int x,y,k;
	       int i,dir;
	       long val;
		Pair (int x,int y){
			this.x=x;
			this.y=y;
		}
		public int compareTo(Pair o) {
			if(this.x!=o.x)
				return this.x-o.x;
			return this.y-o.y;
		}

		public String toString(){
			return x+" "+y+" "+k+" "+i;}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair)o;
				return p.x == x && p.y == y;
			}
			return false;
		}
		public int hashCode() {
			return new Long(x).hashCode()*31 + new Long(y).hashCode() ;
		}
	}

	    public static boolean isPal(String s){
	        for(int i=0, j=s.length()-1;i<=j;i++,j--){
	                if(s.charAt(i)!=s.charAt(j)) return false;
	        }
	        return true;
	    }
	    public static String rev(String s){
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
	    }

	    public static long gcd(long x,long y){
		if(y==0)
			return x;
		else
			return gcd(y,x%y);
	    }

	    public static int gcd(int x,int y){
	    	if(y==0)
	    		return x;
	    	return gcd(y,x%y);
	    }

	    public static long gcdExtended(long a,long b,long[] x){

	        if(a==0){
	            x[0]=0;
	            x[1]=1;
	            return b;
	        }
	        long[] y=new long[2];
	        long gcd=gcdExtended(b%a, a, y);

	        x[0]=y[1]-(b/a)*y[0];
	        x[1]=y[0];

	        return gcd;
	    }

	    public static int abs(int a,int b){
		return (int)Math.abs(a-b);
	    }

	    public static long abs(long a,long b){
		return (long)Math.abs(a-b);
	    }

	    public static int max(int a,int b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static int min(int a,int b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long max(long a,long b){
		if(a>b)
			return a;
		else
			return b;
	    }

	    public static long min(long a,long b){
		if(a>b)
			return b;
		else
			return a;
	    }

	    public static long pow(long n,long p,long m){
		 long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    if(result>=m)
		    result%=m;
		    p >>=1;
		    n*=n;
		    if(n>=m)
		    n%=m;
		}
		return result;
	    }

	    public static long pow(long n,long p){
		long  result = 1;
		  if(p==0)
		    return 1;
		if (p==1)
		    return n;
		while(p!=0)
		{
		    if(p%2==1)
		        result *= n;
		    p >>=1;
		    n*=n;
		}
		return result;
	    }
	    public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
	    void run() throws Exception {
			is = System.in;
			out = new PrintWriter(System.out);
			solve();
			out.flush();
		}

	    public static void main(String[] args) throws Exception {
			new Thread(null, new Runnable() {
				public void run() {
					try {
						new code5().run();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}, "1", 1 << 26).start();

	    	//new code5().run();
		}
	    private byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		private int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b));
			return b;
		}

		private double nd() {
			return Double.parseDouble(ns());
		}

		private char nc() {
			return (char) skip();
		}

		private String ns() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		private char[] ns(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		private char[][] nm(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = ns(m);
			return map;
		}

		private int[] na(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = ni();
			return a;
		}
		private long[] nl(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nl();
			return a;
		}

		private int ni() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		private long nl() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

}


import java.io.*;
import java.util.*;

/*
TASK: CFC
LANG: JAVA
 */
public class CFC {
    static int n;
    static int[][] dp;
    static boolean[] s;
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner(System.in); //new FileInputStream(new File("CFC.in")));
        //PrintWriter out = new PrintWriter(new File("CFC.out"));
        n = in.nextInt();
        if(n == 1){
            System.out.println(1);
            return;
        }
        dp = new int[n][n+1];
        s = new boolean[n];
        for(int i = 0;i <n; i++)s[i] = in.next().equals("s");
        for(int j = 0;j < n; j++){
            if(s[n-2])dp[n-1][j] = j+1;
            else dp[n-1][j] = 1;
        }
        int suma , sumb;
        for(int i = n-2; i >= 0; i--){
            if(i == 0 ? true : s[i-1]){
                if(s[i]) {
                    for (int j = 0; j < n; j++) {
                        dp[i][j] = ((j == 0 ? 0 : dp[i][j - 1]) + dp[i + 1][j]) % 1000000007;
                    }
                }
                else{
                    for(int j = 0;j < n; j++){
                        dp[i][j] = ((j == 0 ? 0 : dp[i][j-1]) + dp[i+1][j+1]) % 1000000007;
                    }
                }
            }
            else{
                if(s[i]){
                    for(int j = 0;j < n; j++){
                        dp[i][j] = dp[i+1][j];
                    }
                }
                else{
                    for(int j = 0;j < n; j++){
                        dp[i][j] = dp[i+1][j+1];
                    }
                }
            }
        }
        System.out.println(dp[0][0]);
    }

    private static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public FastScanner(InputStream stream) {
            this.stream = stream;
        }

        int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) return -1;
            }
            return buf[curChar++];
        }

        boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        boolean isEndline(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }

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

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

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

        public String next() {
            int c = read();
            while (isSpaceChar(c)) c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public String nextLine() {
            int c = read();
            while (isEndline(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndline(c));
            return res.toString();
        }
    }
}


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());
*/


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


import java.util.*;
import java.io.*;
import java.math.*;
public class A{

    void solve(){
        int n=ni();
        s=new char[n+1];
        s[0]='.';
        for(int i=1;i<=n;i++) s[i]=ns().charAt(0);
        dp=new long[5001][5001];

        dp[1][0]=1;
        long sum[]=new long[n+2];
        sum[0]=1;
        for(int i=2;i<=n;i++){
            for(int j=0;j<=n;j++) {
                if (s[i - 1] == 'f') {
                        if(j-1>=0) dp[i][j]=dp[i-1][j-1];
                        else dp[i][j]=0;
                }else {
                   dp[i][j]=sum[j];
                }
            }
            for(int j=n;j>=0;j--){
                sum[j]=(sum[j+1]+dp[i][j])%M;
            }
        }
        long ans=0;
        for(int i=0;i<=n;i++){
            ans+=dp[n][i];
            if(ans>=M) ans%=M;
        }
        pw.println(ans);

    }
    char s[];
    long dp[][];
    long go(int x,int cnt,int n){
   //    pw.println(x+" "+cnt);
        if(x>n) return 1;
        long cc=0;
        if(dp[x][cnt]!=-1) return dp[x][cnt];
        if(s[x]=='f'){
            cc=(cc+go(x+1,cnt+1,n))%M;
        }else {

            for(int j=cnt;j>=0;j--) cc=(cc+go(x+1,j,n))%M;
            if(x==n) cc=(cc-cnt+M)%M;
        }
        cc%=M;

        dp[x][cnt]=cc;
        return cc;
    }

    long M=(long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
    }

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

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}


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();	}
}


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

}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.TreeMap;

import static java.lang.Math.abs;
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.sqrt;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.reverse;
import static java.util.Collections.reverseOrder;
import static java.util.Collections.sort;

public class Main {
    private FastScanner in;
    private PrintWriter out;

    private void solve() throws IOException {
        solveC();
    }

    private void solveA() throws IOException {
        char[] n = in.next().toCharArray(), s = in.next().toCharArray();
        out.print(n[0]);
        for (int i = 1; i < n.length && n[i] < s[0]; i++)
            out.print(n[i]);
        out.print(s[0]);
    }

    private void solveB() throws IOException {
        int n = in.nextInt();
        long dp[] = new long[n + 1];
        for (int i = 1; i <= n; i++) {
            dp[i] = i + (i < 3 ? 0 : dp[i - 2]);
        }
        out.print(dp[n]);
    }

    private void solveC() throws IOException {
        int n = in.nextInt(), prev = -1;

        long sum, mod = (long) 1e9 + 7, p;

        long[] deep = new long[n + 10];
        deep[0] = 1;
        char c;
        for (int cur = 0; cur < n; cur++) {
            c = in.nextLine().charAt(0);
            if (prev + 1 != cur) {
                sum = 0;
                if (c == 'f') {
                    for (int i = deep.length - 1; i > 0; i--) {
                        sum += deep[i - 1];
                        sum %= mod;
                        deep[i] = sum;
                    }
                    deep[0] = 0;
                } else {
                    for (int i = deep.length - 1; i >= 0; i--) {
                        sum += deep[i];
                        sum %= mod;
                        deep[i] = sum;
                    }
                }
            }

            if (c != 's') {
                if (cur == prev + 1) {
                    for (int i = deep.length - 1; i > 0; i--) {
                        deep[i] = deep[i - 1];
                    }
                    deep[0] = 0;
                }
                prev = cur;
            }

            //out.println(Arrays.toString(deep));
        }

        long ans = 0;
        for (int i = 0; i < deep.length; i++) {
            ans += deep[i];
            ans %= mod;
        }
        out.println(ans);
    }

    private void solveD() throws IOException {

    }

    private void solveE() throws IOException {

    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

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

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

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

        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();
        }

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

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        solve();

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

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


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());
        }
    }
}


import java.io.BufferedReader;
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.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class c {

	static boolean seq[];
	static long memo[][], mod = (long)1e9 + 7;
	static long go(int n, int d) {
		long ans = 0;
		if(d < 0) return 0;
		if(n == seq.length) return 1;
		int f = 1;
		if(n > 0) f = seq[n-1]?1:0;
		if(memo[n][d] != -1) return memo[n][d];
		if(f == 0) {
			ans += go(n + 1, d + (seq[n]?1:0));
			ans %= mod;
			ans += go(n, d-1);
			ans %= mod;
		}
		if(f == 1) {
			ans += go(n + 1, d + (seq[n]?1:0));
			ans %= mod;
		}
		return memo[n][d] = ans;
	}

	public static void main(String args[]) throws IOException {
		FastScanner in = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		//BEGIN HERE
		int n = in.nextInt();
		seq = new boolean[n];
		for (int i = 0; i  < n; i++ ) {
			seq[i] = (in.next().charAt(0) == 'f');
		}
		memo = new long[n][n+1];
		for(int i = 0; i < n; i++) {
				Arrays.fill(memo[i], -1);
		}
		System.out.println(go(0, 0));
		out.close();
	}

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream i) {
			br = new BufferedReader(new InputStreamReader(i));
			st = null;
		}

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

		public String nextLine() throws IOException {
			if (st == null) {
				st = new StringTokenizer(br.readLine());
			}
			String line = st.nextToken("\n");
			st = null;
			return line;
		}

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

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

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

	public static class combinatorics {
		static long modInv(long a, long b) {
			return 1 < a ? b - modInv(b % a, a) * b / a : 1;
		}

		static long factorial[], mod;

		combinatorics(int n, long MOD) {
			mod = MOD;
			factorial = new long[n + 1];
			factorial[0] = 1;
			for (int i = 1; i <= n; i++) {
				factorial[i] = i * factorial[i - 1];
				factorial[i] %= mod;
			}
		}

		static long nCr(int n, int r) {
			if (r > n)
				return 0;
			return (factorial[n] * modInv((factorial[n - r] * factorial[r]) % mod, mod)) % mod;
		}
	}

	public static class DisjointSet {
		int p[], r[], s[];
		int numDisjoint;

		DisjointSet(int N) {
			numDisjoint = N;
			r = new int[N];
			s = new int[N];
			p = new int[N];
			for (int i = 0; i < N; i++)
				p[i] = i;
		}

		int findSet(int i) {
			return (p[i] == i) ? i : (p[i] = findSet(p[i]));
		}

		boolean isSameSet(int i, int j) {
			return findSet(i) == findSet(j);
		}

		void unionSet(int i, int j) {
			if (!isSameSet(i, j)) // if from different set
			{
				numDisjoint--;
				int x = findSet(i), y = findSet(j);
				if (r[x] > r[y]) {
					p[y] = x; // rank keeps the tree short
					s[x] += s[y];
				} else {
					p[x] = y;
					if (r[x] == r[y])
						r[y]++;
					s[y] += s[x];
				}
			}
		}

		int sizeOfSet(int i) {
			return s[findSet(i)];
		}
	};

}


//package round455;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class C {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni();
		int mod = 1000000007;
		long[] dp = new long[5005];
		dp[0] = 1;
		for(int i = 0;i < n;i++){
			char c = nc();
			if(c == 's'){
				if(i < n-1){
					for(int j = 5003;j >= 0;j--){
						dp[j] += dp[j+1];
						if(dp[j] >= mod)dp[j] -= mod;
					}
				}
			}else{
				for(int j = 5003;j >= 0;j--){
					dp[j+1] = dp[j];
				}
				dp[0] = 0;
			}
		}
		long ans = 0;
		for(int i = 0;i < 5005;i++)ans += dp[i];
		out.println(ans % mod);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

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

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


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();
		}
	}

}