func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1e9 + 7;   int mini, c;   const int MAXN = 2e3 + 3;   long long dp[2][MAXN][MAXN];   long long go(int lft, int cur, bool f) {     if (lft == 0 and !f) return 1;     if (dp[f][lft][cur] != -1) return dp[f][lft][cur];     long long ret = 0;     if (f) {       if (mini >= 0 and lft >= c + cur) ret += go(lft, cur + c, false);       if (ret >= MOD) ret -= MOD;       if (mini < 0 and abs(mini) <= cur and lft >= c + cur)         ret += go(lft, cur + c, false);       if (ret >= MOD) ret -= MOD;       if (lft) ret += go(lft - 1, cur + 1, f);       if (ret >= MOD) ret -= MOD;       if (cur != 0 and lft) ret += go(lft - 1, cur - 1, f);       if (ret >= MOD) ret -= MOD;     } else {       if (cur != 0 and lft) ret += go(lft - 1, cur - 1, f);       if (ret >= MOD) ret -= MOD;       if (lft - 1 >= cur + 1 and lft) ret += go(lft - 1, cur + 1, f);       if (ret >= MOD) ret -= MOD;     }     return dp[f][lft][cur] = ret;   }   int main() {     int n, m;     cin >> n >> m;     string str;     cin >> str;     mini = 1e9;     c = 0;     for (int i = 0; i < ((int)str.size()); i++) {       if (str[i] ==  ( )         ++c;       else         --c;       mini = min(mini, c);     }     memset(dp, -1, sizeof(dp));     cout << go(n - m, 0, true) << endl;     return 0;   }   