#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
char a[800];
int n, Hash[800], tmp[800];
long long dp[705][705][4][4];
void dfs(int l, int r) {
  if (l + 1 == r) {
    dp[l][r][0][1] = 1;
    dp[l][r][1][0] = 1;
    dp[l][r][2][0] = 1;
    dp[l][r][0][2] = 1;
    return;
  }
  if (Hash[r] == l) {
    dfs(l + 1, r - 1);
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (i != 1)
          dp[l][r][1][0] = (dp[l][r][1][0] + dp[l + 1][r - 1][i][j]) % mod;
        if (j != 1)
          dp[l][r][0][1] = (dp[l][r][0][1] + dp[l + 1][r - 1][i][j]) % mod;
        if (i != 2)
          dp[l][r][2][0] = (dp[l][r][2][0] + dp[l + 1][r - 1][i][j]) % mod;
        if (j != 2)
          dp[l][r][0][2] = (dp[l][r][0][2] + dp[l + 1][r - 1][i][j]) % mod;
      }
    }
  } else {
    int p = Hash[l];
    dfs(l, p);
    dfs(p + 1, r);
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        for (int x = 0; x < 3; x++) {
          for (int y = 0; y < 3; y++) {
            if (!(x == 1 && y == 1 || x == 2 && y == 2))
              dp[l][r][i][j] = (dp[l][r][i][j] +
                                (dp[l][p][i][x] * dp[p + 1][r][y][j]) % mod) %
                               mod;
          }
        }
      }
    }
  }
}
int main() {
  while (~scanf("%s", a + 1)) {
    n = strlen(a + 1);
    int k = 0;
    memset(tmp, 0, sizeof(tmp));
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i <= n; i++) {
      if (a[i] == '(') {
        tmp[k++] = i;
      } else {
        Hash[i] = tmp[k - 1];
        Hash[tmp[k - 1]] = i;
        k--;
      }
    }
    dfs(1, n);
    long long ans = 0;
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        ans = (ans + dp[1][n][i][j]) % mod;
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
