#include <bits/stdc++.h>
using namespace std;
char a[1007];
long long f[1007][1007][3][3], ans, mod;
int s[1007], l, d[1007];
void dfs(int l, int r) {
  if (l + 1 == r)
    f[l][r][0][1] = f[l][r][0][2] = f[l][r][1][0] = f[l][r][2][0] = 1;
  else if (s[l] == r) {
    dfs(l + 1, r - 1);
    for (int i = 0; i <= 2; i++)
      for (int 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 (j != 1)
          f[l][r][0][1] = (f[l][r][0][1] + 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 != 2)
          f[l][r][0][2] = (f[l][r][0][2] + f[l + 1][r - 1][i][j]) % mod;
      }
  } else {
    dfs(l, s[l]);
    dfs(s[l] + 1, r);
    for (int i = 0; i <= 2; i++)
      for (int j = 0; j <= 2; j++)
        for (int k = 0; k <= 2; k++)
          for (int q = 0; q <= 2; q++) {
            if (k == q && k != 0) continue;
            f[l][r][i][j] = (f[l][r][i][j] +
                             (f[l][s[l]][i][k] * f[s[l] + 1][r][q][j]) % mod) %
                            mod;
          }
  }
}
int main() {
  scanf("%s", &a);
  mod = 1e9 + 7;
  for (int t = 0; a[l] != '\0'; l++)
    if (a[l] == '(')
      d[++t] = l;
    else {
      s[l] = d[t];
      s[d[t--]] = l;
    }
  dfs(0, l - 1);
  for (int i = 0; i <= 2; i++)
    for (int j = 0; j <= 2; j++) ans = (ans + f[0][l - 1][i][j]) % mod;
  printf("%lld\n", ans);
}
