func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int pwr(long long int base, long long int p) {     long long int ans = 1;     while (p) {       if (p & 1) ans = (ans * base) % 1000000007;       base = (base * base) % 1000000007;       p /= 2;     }     return ans;   }   long long int gcd(long long int a, long long int b) {     if (b == 0) return a;     return gcd(b, a % b);   }   long long int n;   int dyn[5005][5005][2];   char ch[5001][2];   int dp(int neww, int val, int cont) {     dyn[neww][val][cont] %= 1000000007;     if (neww == n && !val) return 1;     if (dyn[neww][val][cont] != -1) return dyn[neww][val][cont];     if (val < 0 || neww > n) return 0;     int final = 0;     if (ch[neww][0] !=  f ) {       final += dp(neww + 1, val, 0);       final = final % 1000000007;     } else {       final += dp(neww + 1, val + 1, 1);       final = final % 1000000007;     }     if (cont == 0) {       final += dp(neww, val - 1, 0);       final = final % 1000000007;     }     final = final % 1000000007;     return dyn[neww][val][cont] = final;   }   int main() {     int i, j, k, m;     memset(dyn, -1, sizeof dyn);     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %s , &ch[i]);     }     int ans = dp(0, 0, 0);     printf( %d n , ans);   }   