#include <bits/stdc++.h>
using namespace std;
const int maxn = 707;
const int mod = 1000000007;
int n, top;
int sta[maxn], ri[maxn];
long long ans, dp[maxn][maxn][3][3];
char data[maxn];
bool vis[maxn][maxn];
void dfs(int l, int r) {
  if (vis[l][r]) return;
  if (l + 1 == r) {
    dp[l][r][1][0] = dp[l][r][0][1] = 1;
    dp[l][r][2][0] = dp[l][r][0][2] = 1;
    vis[l][r] = 1;
    return;
  } else {
    if (ri[l] == r) {
      dfs(l + 1, r - 1);
      for (int i = 0; i <= 2; i++)
        for (int j = 0; j <= 2; j++) {
          if (i != 1) dp[l][r][1][0] += dp[l + 1][r - 1][i][j];
          if (i != 2) dp[l][r][2][0] += dp[l + 1][r - 1][i][j];
          if (j != 1) dp[l][r][0][1] += dp[l + 1][r - 1][i][j];
          if (j != 2) dp[l][r][0][2] += dp[l + 1][r - 1][i][j];
        }
      dp[l][r][1][0] %= mod;
      dp[l][r][2][0] %= mod;
      dp[l][r][0][1] %= mod;
      dp[l][r][0][2] %= mod;
    } else {
      int k = ri[l];
      dfs(l, k);
      dfs(k + 1, r);
      for (int i = 0; i <= 2; i++)
        for (int j = 0; j <= 2; j++)
          for (int ii = 0; ii <= 2; ii++)
            for (int jj = 0; jj <= 2; jj++) {
              if (j == ii && j != 0) continue;
              dp[l][r][i][jj] += dp[l][k][i][j] * dp[k + 1][r][ii][jj] % mod;
            }
      for (int i = 0; i <= 2; i++)
        for (int j = 0; j <= 2; j++) dp[l][r][i][j] %= mod;
    }
    vis[l][r] = 1;
  }
}
int main() {
  scanf("%s", data + 1);
  n = strlen(data + 1);
  for (int i = 1; i <= n; i++) {
    if (data[i] == '(')
      sta[++top] = i;
    else
      ri[sta[top--]] = i;
  }
  dfs(1, n);
  for (int i = 0; i <= 2; i++)
    for (int j = 0; j <= 2; j++) ans += dp[1][n][i][j];
  ans %= mod;
  printf("%d\n", ans);
  return 0;
}
