func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long Mod = 1e9 + 7;   const long long maxn = 700 + 10;   long long n;   long long brac[maxn];   char s[maxn];   stack<long long> sta;   inline long long read() {     long long x = 0;     bool fopt = 1;     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) fopt = 0;     for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + ch - 48;     return fopt ? x : -x;   }   long long f[maxn][maxn][3][3];   void dfs(long long l, long long r) {     if (r == l + 1)       return f[l][r][0][1] = f[l][r][1][0] = f[l][r][0][2] = f[l][r][2][0] = 1,              void();     if (brac[l] == r) {       dfs(l + 1, r - 1);       for (long long i = 0; i <= 2; i++)         for (long long j = 0; j <= 2; j++) {           if (i != 1)             f[l][r][1][0] = (f[l][r][1][0] + f[l + 1][r - 1][i][j]) % Mod;           if (i != 2)             f[l][r][2][0] = (f[l][r][2][0] + f[l + 1][r - 1][i][j]) % Mod;           if (j != 1)             f[l][r][0][1] = (f[l][r][0][1] + f[l + 1][r - 1][i][j]) % Mod;           if (j != 2)             f[l][r][0][2] = (f[l][r][0][2] + f[l + 1][r - 1][i][j]) % Mod;         }     } else {       dfs(l, brac[l]);       dfs(brac[l] + 1, r);       for (long long i = 0; i <= 2; i++)         for (long long j = 0; j <= 2; j++)           for (long long k = 0; k <= 2; k++)             for (long long q = 0; q <= 2; q++)               if (!(j && j == k))                 f[l][r][i][q] =                     (f[l][r][i][q] +                      f[l][brac[l]][i][j] * f[brac[l] + 1][r][k][q] % Mod) %                     Mod;     }   }   signed main() {     scanf( %s , s + 1);     n = strlen(s + 1);     for (long long i = 1; i <= n; i++) {       if (s[i] ==  ( )         sta.push(i);       else         brac[sta.top()] = i, sta.pop();     }     dfs(1, n);     long long ans = 0;     for (long long i = 0; i <= 2; i++)       for (long long j = 0; j <= 2; j++) ans = (ans + f[1][n][i][j]) % Mod;     cout << ans << endl;     return 0;   }   