#include <bits/stdc++.h>
using namespace std;
const int maxn = 800;
const long long mod = 1000000007;
long long dp[maxn][maxn][3][3];
int match[maxn];
char str[maxn];
bool judge(int c1, int c2) { return c1 == 0 || c2 == 0 || c1 != c2; }
long long dfs(int i, int j, int c1, int c2) {
  if (dp[i][j][c1][c2] != -1) return dp[i][j][c1][c2];
  if (i + 1 > j) return dp[i][j][c1][c2] = 0;
  if (i == j) return dp[i][j][c1][c2] = 1LL;
  long long ans = 0;
  int k = match[i];
  if (k == j) {
    if ((c1 && c2 == 0) || (c1 == 0 && c2)) {
      if (i + 1 == j) return dp[i][j][c1][c2] = 1LL;
      for (int ii = 0; ii <= 2; ii++) {
        for (int jj = 0; jj <= 2; jj++) {
          if (judge(c1, ii) && judge(jj, c2))
            ans = (ans + dfs(i + 1, j - 1, ii, jj)) % mod;
        }
      }
    }
  } else {
    for (int ii = 0; ii <= 2; ii++) {
      for (int jj = 0; jj <= 2; jj++) {
        if (judge(ii, jj))
          ans = (ans + dfs(i, k, c1, ii) * dfs(k + 1, j, jj, c2) % mod) % mod;
      }
    }
  }
  return dp[i][j][c1][c2] = ans;
}
int main() {
  gets(str);
  int len = strlen(str);
  stack<int> st;
  for (int i = 0; i < len; i++) {
    if (str[i] == '(')
      st.push(i);
    else {
      match[st.top()] = i;
      st.pop();
    }
  }
  memset(dp, -1, sizeof(dp));
  long long ans = 0;
  for (int i = 0; i <= 2; i++) {
    for (int j = 0; j <= 2; j++) {
      ans = (ans + dfs(0, len - 1, i, j)) % mod;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
