func_code_string: #include <bits/stdc++.h>   using namespace std;   char s[705];   int match[705];   int tmp[705];   long long dp[705][705][3][3];   void getmatch(int len) {     int kk = 0;     for (kk = 0; kk <= 10000; kk++)       ;     int p = 0;     for (int i = 0; i < len; i++) {       if (s[i] ==  ( )         tmp[p++] = i;       else {         match[i] = tmp[p - 1];         match[tmp[p - 1]] = i;         p--;       }     }   }   void dfs(int l, int r) {     int kk = 0;     for (kk = 0; kk <= 10000; kk++)       ;     if (l + 1 == r) {       dp[l][r][0][1] = 1;       dp[l][r][1][0] = 1;       dp[l][r][0][2] = 1;       dp[l][r][2][0] = 1;       return;     }     if (match[l] == r) {       dfs(l + 1, r - 1);       for (int i = 0; i < 3; i++) {         for (int j = 0; j < 3; j++) {           if (j != 1)             dp[l][r][0][1] =                 (dp[l][r][0][1] + dp[l + 1][r - 1][i][j]) % 1000000007;           if (i != 1)             dp[l][r][1][0] =                 (dp[l][r][1][0] + dp[l + 1][r - 1][i][j]) % 1000000007;           if (j != 2)             dp[l][r][0][2] =                 (dp[l][r][0][2] + dp[l + 1][r - 1][i][j]) % 1000000007;           if (i != 2)             dp[l][r][2][0] =                 (dp[l][r][2][0] + dp[l + 1][r - 1][i][j]) % 1000000007;         }       }       return;     } else {       int p = match[l];       dfs(l, p);       dfs(p + 1, r);       for (int i = 0; i < 3; i++) {         for (int j = 0; j < 3; j++) {           for (int k = 0; k < 3; k++) {             for (int q = 0; q < 3; q++) {               if (!((k == 1 && q == 1) || (k == 2 && q == 2)))                 dp[l][r][i][j] =                     (dp[l][r][i][j] +                      (dp[l][p][i][k] * dp[p + 1][r][q][j]) % 1000000007) %                     1000000007;             }           }         }       }     }   }   int main() {     while (scanf( %s , s) != EOF) {       int len = strlen(s);       getmatch(len);       int kk = 0;       for (kk = 0; kk <= 10000; kk++)         ;       memset(dp, 0, sizeof(dp));       dfs(0, len - 1);       long long ans = 0;       for (int i = 0; i < 3; i++) {         for (int j = 0; j < 3; j++) {           ans = (ans + dp[0][len - 1][i][j]) % 1000000007;         }       }       printf( %ld n , ans);     }     return 0;   }   