codeparrot/codecomplex huggingface dataset:
// Problem: 908_G. New Year and Original Order
// Time complexity: quadratic
import java.io.*;
import java.util.*;

public class G {

	static final int P = 1_000_000_007;

	int[][] ways;
	int[][] pow;

	void preCalc(int sz) {
		ways = new int[sz][];
		for (int i = 0; i < ways.length; i++) {
			ways[i] = new int[i + 1];
			ways[i][0] = ways[i][i] = 1;
			for (int j = 1; j < i; j++) {
				ways[i][j] = (ways[i - 1][j] + ways[i - 1][j - 1]) % P;
			}
		}

		pow = new int[10][sz];
		pow[0] = null;
		for (int i = 1; i <= 9; i++) {
			pow[i][0] = 1;
			for (int j = 1; j < sz; j++) {
				pow[i][j] = (int) ((long) pow[i][j - 1] * i % P);
			}
		}
	}

	int solve(String ss) {
		int n = ss.length();
		int[] s = new int[n];
		for (int i = 0; i < n; i++) {
			s[i] = ss.charAt(i) - '0';
		}

		preCalc(n + 10);

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

		int[] cnt = new int[10];

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

			int rest = n - i - 1;

			int dig = s[i];

			for (int j = 0; j <= (i == n - 1 ? dig : dig - 1); j++) {
				cnt[j]++; // now we have one more digit >= j

				for (int use = 1; use < 10; use++) {
					// use digits are bad, 10 - use are good
					for (int cntGood = 0; cntGood <= rest; cntGood++) {
						int delta = (int) ((long) ways[rest][cntGood]
								* pow[use][rest - cntGood] % P
								* pow[10 - use][cntGood] % P);
						int idx = cnt[use] + cntGood;
						ans[idx] += delta;
						if (ans[idx] >= P) {
							ans[idx] -= P;
						}
					}
				}

				// System.err.println(Arrays.toString(ans));

			}

			cnt[dig]++;

		}
		
		int ret = 0;
		long mult = 0;
		for (int i = 1; i < ans.length; i++) {
			mult = (10L * mult + 1) % P;
			ret += (int)(mult * ans[i] % P);
			if (ret >= P) {
				ret -= P;
			}
		}
		
		return ret;
	}

	void submit() {
		out.println(solve(nextToken()));
	}

	void stress() {

	}

	void test() {
		StringBuilder sb = new StringBuilder("1");
		for (int i = 0; i < 700; i++) {
			sb.append('0');
		}
		solve(sb.toString());
	}

	G() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		submit();
		// stress();
//		 test();
		out.close();
	}

	static final Random rng = new Random();

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

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

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

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

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

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

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

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}
// Problem: 908_G. New Year and Original Order
// Time complexity: quadratic
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class G {

	static final int MOD = 1000000007;

	static int add(int a, int b) {
		int res = a + b;
		return res >= MOD ? res - MOD : res;
	}

	static int sub(int a, int b) {
		int res = a - b;
		return res < 0 ? res + MOD : res;
	}

	static int mul(int a, int b) {
		int res = (int) ((long) a * b % MOD);
		return res < 0 ? res + MOD : res;
	}

	static int pow(int a, int e) {
		if (e == 0) {
			return 1;
		}
		int r = a;
		for (int i = 30 - Integer.numberOfLeadingZeros(e); i >= 0; i--) {
			r = mul(r, r);
			if ((e & (1 << i)) != 0) {
				r = mul(r, a);
			}
		}
		return r;
	}

	static int inv(int a) {
		return pow(a, MOD - 2);
	}

	static void solve() throws Exception {
		String x = scanString();
//		char xx[] = new char[700];
//		fill(xx, '9');
//		String x = new String(xx);
		int n = x.length();
		int pows[][] = new int[10][n];
		for (int i = 0; i < 10; i++) {
			pows[i][0] = 1;
			for (int j = 1; j < n; j++) {
				pows[i][j] = mul(pows[i][j - 1], i);
			}
		}
		int ru[] = new int[n + 1];
		for (int i = 1; i <= n; i++) {
			ru[i] = add(1, mul(10, ru[i - 1]));
		}
		int facts[] = new int[n];
		facts[0] = 1;
		for (int i = 1; i < n; i++) {
			facts[i] = mul(facts[i - 1], i);
		}
		int factsInv[] = new int[n];
		factsInv[n - 1] = inv(facts[n - 1]);
		for (int i = n - 1; i > 0; i--) {
			factsInv[i - 1] = mul(factsInv[i], i);
		}
		int ans = 0;
		int off[] = new int[10];
		for (int i = 0; i < n; i++) {
			int cd = x.charAt(i) - '0';
			int l = n - i - 1;
			for (int d = 1; d < 10; d++) {
				for (int p = 0; p <= l; p++) {
					int mul = d < cd ? add(mul(d, ru[p + off[d]]), mul(cd - d, ru[p + off[d] + 1])) : mul(cd, ru[p + off[d]]);
					ans = add(ans, mul(mul, mul(mul(pows[d][l - p], pows[10 - d][p]), mul(facts[l], mul(factsInv[p], factsInv[l - p])))));
				}
			}
			for (int d = 0; d <= cd; d++) {
				++off[d];
			}
		}
		for (int d = 1; d < 10; d++) {
			ans = add(ans, ru[off[d]]);
		}
		out.print(ans);
	}

	static int scanInt() throws IOException {
		return parseInt(scanString());
	}

	static long scanLong() throws IOException {
		return parseLong(scanString());
	}

	static String scanString() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}
// Problem: 908_G. New Year and Original Order
// Time complexity: quadratic
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    private static int REM = 1000000007;
    private static int dig;
    private static int[][][] dp = new int[701][701][2];

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

        String X = in.next();
        int N = X.length();

        int[] P = new int[701];
        P[0] = 1;
        for (int i=1; i<P.length; ++i) {
            P[i] = (int)((long)P[i-1] * 10 % REM);
        }

        int ans = 0;
        for (int d=1; d<=9; ++d) { //at least d
            dig = d;

            for (int[][] array2 : dp) {
                for (int[] array1 : array2) {
                    Arrays.fill(array1, -1);
                }
            }

            for (int c=1; c<=N; ++c) { //exact count of at least d
                for (int k=0; k<c; ++k) {
                    ans = (int)((ans + (long)f(0, c, false, X) * P[k]) % REM);
                }
            }
        }
        System.out.println(ans);
    }

    private static int f(int ps, int needed, boolean less, final String X) {
        if (needed < 0) {return 0;}
        if (dp[ps][needed][less?0:1] != -1) {return dp[ps][needed][less?0:1];}
        if (ps == X.length()) {
            if (needed == 0) {return 1;}
            return 0;
        }
        int dg = X.charAt(ps)-'0';

        int ans = 0;
        for (int d=0; d<=9; ++d) {
            if (!less && d>dg) {continue;}

            boolean nless = less || d < dg;
            ans = (int)((ans + (long)f(ps+1, needed-(d>=dig?1:0), nless, X)) % REM);
        }

        dp[ps][needed][less?0:1] = ans;
        return ans;
    }
}
// Problem: 908_G. New Year and Original Order
// Time complexity: quadratic
import java.io.*;
import java.util.*;

public class cf908G {
	final static int MOD = 1_000_000_007;
	
	public static void main(String[] argv) {
		cf908G pro = new cf908G();
		
		InputStream fin = null;
		if (System.getProperty("ONLINE_JUDGE") == null) {
			try {
				fin = new FileInputStream("input.txt");
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		} else {
			fin = System.in;
		}
		pro.solve(new Scanner(fin), System.out);
	}
	
	private void solve(Scanner scanner, PrintStream out) {
		long ans = 0;
		String X = scanner.next();
		for (int x = 0; x < 9; x++) {
			ans = (ans + solve2(x, X)) % MOD;
		}
		out.println((ans % MOD + MOD) % MOD);
	}

	private long solve2(int x, String X) {
		int[][][] f = new int[X.length() + 1][X.length() + 1][2];
		f[0][0][1] = 1;
		
		int n = X.length();
		for (int i = 0; i < n; i++) {
			for (int j = 0; j <= n; j++) {
				for (int u = 0; u < 2; u++) {
					int val = f[i][j][u];
					if (val == 0) continue;
					
					for (int num = 0; num < 10; num++) {
						int Xi = X.charAt(i) - '0';
						if (u == 1 && num > Xi) break;
						int _i = i + 1;
						int _j = num <= x ? j + 1 : j;
						int _u = u == 1 && num == Xi ? 1 : 0;
						
						f[_i][_j][_u] = (f[_i][_j][_u] + val) % MOD;
					}
				}
			}
		}
		
		long base = 1;
		long ret = 0;
		for (int i = n; i > 0; i--) {
			long t = 0;
			for (int j = 0; j < i; j++) {
				t = (t + f[n][j][0] + f[n][j][1]) % MOD;
			}
			
			ret = (ret + base * t) % MOD;
			
			base = (base * 10) % MOD;
		}
		return ret;
	}
	
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic


import java.util.Arrays;

public class Main {

	private static void solve() {
		int n = ni();
		String[] lines = new String[n];
		for(int i = 0; i < n; i ++) {
			lines[i] = next();
		}
		int mod = 1000000000 + 7;
		
		long[][] dp = new long[2][n + 1];
		dp[0][0] = 1;
		for (int i = 0; i < n; i ++) {
			int from = i % 2;
			int to = (i + 1) % 2;
			boolean flg = i == 0 || lines[i - 1].equals("s");
			if (flg) {
				long v = Arrays.stream(dp[from]).sum();
				for (int j = 0; j <= n; j ++) {
					dp[to][j] += v;
					dp[to][j] %= mod;
					v -= dp[from][j];
				}
			} else {
				for (int j = 0; j < n; j ++) {
					dp[to][j + 1] += dp[from][j];
					dp[to][j + 1] %= mod;
				}
			}
			Arrays.fill(dp[from], 0);
		}
		long ret = Arrays.stream(dp[n % 2]).sum() % mod;
		System.out.println(ret);
	}
	

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			@Override
			public void run() {
				long start = System.currentTimeMillis();
				String debug = args.length > 0 ? args[0] : null;
				if (debug != null) {
					try {
						is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
					} catch (Exception e) {
						throw new RuntimeException(e);
					}
				}
				reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
				solve();
				out.flush();
				tr((System.currentTimeMillis() - start) + "ms");
			}
		}, "", 64000000).start();
	}

	private static java.io.InputStream is = System.in;
	private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
	private static java.util.StringTokenizer tokenizer = null;
	private static java.io.BufferedReader reader;

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

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

	private static long nl() {
		return Long.parseLong(next());
	}

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

	private static char[] ns() {
		return next().toCharArray();
	}

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

	private static int[][] ntable(int n, int m) {
		int[][] table = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[i][j] = ni();
			}
		}
		return table;
	}

	private static int[][] nlist(int n, int m) {
		int[][] table = new int[m][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[j][i] = ni();
			}
		}
		return table;
	}

	private static int ni() {
		return Integer.parseInt(next());
	}

	private static void tr(Object... o) {
		if (is != System.in)
			System.out.println(java.util.Arrays.deepToString(o));
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public class C {
	static final long MOD = 1_000_000_007;
	public static void main(String[] args) throws Exception {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		long[][] dp = new long[N][N];
		dp[0][0] = 1L;
		for(int i = 0; i < N-1; i++) {
			char oper = sc.next().charAt(0);
			if(oper == 'f') {
				dp[i+1][0] = 0L;
				for(int j = 1; j < N; j++) {
					dp[i+1][j] = dp[i][j-1];
				}
			}
			else {
				dp[i+1][N-1] = dp[i][N-1];
				for(int j = N-2; j >= 0; j--) {
					dp[i+1][j] = (dp[i+1][j+1] + dp[i][j]) % MOD;
				}
			}
		}
		long res = 0;
		for(int i = 0; i < N; i++) {
			res += dp[N-1][i];
			res %= MOD;
		}
		out.println(res);
		out.flush();
	}

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

		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 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());
		}

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

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

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

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

public class C {

	public static void main(String[] args){
		FastScanner scan = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		n = scan.nextInt(); mod = (int)1e9+7;
		in = new char[n];
		for(int i = 0; i < n; i++) in[i] = scan.next().charAt(0);
		dp = new Long[n][n];
		out.println(go(0, 0));
		out.close();
	}
	
	static long go(int at, int i) {
		if(at == n-1) return 1;
		if(dp[at][i] != null) return dp[at][i];
		long res = 0;
		if(in[at] == 's') {
			res += go(at+1, i);
			res %= mod;
			if(i > 0) {
				res += go(at, i-1);
				res %= mod;
			}
		} else {
			res += go(at+1, i+1);
			res %= mod;
		}
		return dp[at][i] = res;
	}
	
	static Long[][] dp;
	static int n, mod;
	static char[] in;
	
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			try	{
				br = new BufferedReader(new InputStreamReader(System.in));
				st = new StringTokenizer(br.readLine());
			} catch (Exception e){e.printStackTrace();}
		}

		public String next() {
			if (st.hasMoreTokens())	return st.nextToken();
			try {st = new StringTokenizer(br.readLine());}
			catch (Exception e) {e.printStackTrace();}
			return st.nextToken();
		}

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

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

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

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

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for(int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}

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

		public double[] nextDoubleArray(int n){
			double[] a = new double[n];
			for(int i = 0; i < n; i++) a[i] = nextDouble();
			return a;
		}

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


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


public class PythonIndentation
{
	public static void main(String args[])
	{
		Scanner in = new Scanner(System.in) ;
		int n = in.nextInt() ;
		boolean[] lst = new boolean[n] ;
		for(int i=0;i<n;i++)
		{
			lst[i] = (in.next().equals("s"))?false:true ;
		}
		System.out.println(dp(lst)) ;
	}
	static void  arrayPrinter(int[][] dp)
	{
		System.out.println(":::") ;
		for(int i=0;i<dp.length;i++)
		{
			for(int j=0;j<dp[0].length;j++)
			{
				System.out.print(dp[i][j]+" ") ;
			}
			System.out.println() ;
		}
	}
	static int dp(boolean[] lst)
	{//false in lst means an "s" (simple statement), and true a "f"(for loop)
		int[][] dp = new int[2][lst.length] ;
		dp[0][0] = 1 ;
		for(int i=1;i<lst.length;i++)
		{
			// arrayPrinter(dp) ;
			for(int j=0;j<lst.length;j++)
			{
				if(lst[i-1])//(i-1)st statement is a for loop 
				{
					if(j==0)
						dp[i%2][j] = 0 ;
					else
						dp[i%2][j] = dp[(i-1)%2][j-1] ;
				}
			
				else//i-1 st statement is a simple statement
				{
					if(j==0)
					{
						int temp = 0 ;
						for(int k=0;k<lst.length;k++)
							temp = (temp+dp[(i-1)%2][k])%1000000007 ;
						dp[i%2][j] = temp ;
					}
					else
						dp[i%2][j] = (dp[i%2][j-1]-dp[(i-1)%2][j-1])%1000000007 ;
				}
			}
		}
		int ans = 0 ;
		for(int i=0;i<lst.length;i++)
		{
			ans = (ans + dp[(lst.length-1)%2][i])%1000000007 ;
		}
		if(ans<0)
			ans = ans + 1000000007 ;
		// arrayPrinter(dp) ;
		return ans ;
	}
}
// Problem: 909_C. Python Indentation
// Time complexity: quadratic
import java.io.*;
import java.util.*;

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

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

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

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

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

			dp[0][0] = 1;

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

/*			System.out.println("dp :");

			for (int i = 0; i <= n; i++)
			{
				System.out.print("i : " + i + " => ");
				for (int j = 0; j <= n; j++)
					System.out.print(dp[i][j] + " ");
				System.out.println();
			}*/
		}

		long find(int curr, int backIndents)
		{
//			System.out.println("curr : " + curr + ", bI : " + backIndents);
			if (backIndents < 0)
				return 0;

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

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

			long ans;

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

				if (arr[curr - 1] != 'f')
				{
//					System.out.println("calling from curr : " + curr + ", bI : " + backIndents);
					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();
		}
	}

}

/*

6
f
f
s
s
s
s
: 10

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

public class PythonIndentation
{
	public static void main(String args[])
	{
		Scanner in = new Scanner(System.in) ;
		int n = in.nextInt() ;
		boolean[] lst = new boolean[n] ;
		for(int i=0;i<n;i++)
		{
			lst[i] = (in.next().equals("s"))?false:true ;
		}
		System.out.println(dp(lst)) ;
	}
	// static void  arrayPrinter(int[][] dp)
	// {
		// System.out.println(":::") ;
		// for(int i=0;i<dp.length;i++)
		// {
			// for(int j=0;j<dp[0].length;j++)
			// {
				// System.out.print(dp[i][j]+" ") ;
			// }
			// System.out.println() ;
		// }
	// }
	static long dp(boolean[] lst)
	{//false in lst means an "s" (simple statement), and true a "f"(for loop)
		long[][] dp = new long[lst.length][lst.length] ;
		dp[0][0] = 1 ;
		for(int i=1;i<lst.length;i++)
		{
			// int sum_i = 0;
			// for(int j=0;j<lst.length;j++)
				// sum_i = (sum_i+dp[i-1][j])%1000000007 ;
			
			for(int j=0;j<lst.length;j++)
			{
				if(lst[i-1])//(i-1)st statement is a for loop 
				{
					if(j==0)
						dp[i][j] = 0 ;
					else
						dp[i][j] = dp[i-1][j-1] ;
				}
			
				else//i-1 st statement is a simple statement
				{
					if(j==0)
					{
						for(int k=0;k<lst.length;k++)
							dp[i][j] = (dp[i][j]+dp[i-1][k])%1000000007 ;
					}
					else
						dp[i][j] = (dp[i][j-1]-dp[i-1][j-1])%1000000007 ;
					// if(j==lst.length-1)
						// dp[i][j] = dp[i][j-1] ;
					// else
						// dp[i][j] = (dp[i-1][j]+dp[i][j+1])%1000000007 ;
				}
			}
		}
		// for(int i=0;i<lst.length;i++)
			// System.out.print(dp[lst.length-1][i]+" ") ;
		// System.out.println() ;
		long ans = 0 ;
		for(int i=0;i<lst.length;i++)
		{
			ans = (ans + dp[lst.length-1][i])%1000000007 ;
		}
		if(ans<0)
			ans = ans + 1000000007 ;
		return ans ;
	}
}