#include <bits/stdc++.h>
using namespace std;
char bar[712];
int to[712];
long dp[712][712][3][3];
bool judge(int c1, int c2) { return c1 == 0 || c2 == 0 || c1 != c2; }
long long dfs(int stt, int nd, int i, int j) {
  if (dp[stt][nd][i][j] != -1) return dp[stt][nd][i][j];
  if (stt > nd) return dp[stt][nd][i][j] = 0;
  if (stt == nd) return dp[stt][nd][i][j] = 1LL;
  long long ans = 0;
  int k = to[stt];
  if (k == nd) {
    if ((i == 0 && j) || (j == 0 && i)) {
      if (stt + 1 == nd) return dp[stt][nd][i][j] = 1LL;
      for (int c1 = 0; c1 < 3; ++c1)
        for (int c2 = 0; c2 < 3; ++c2) {
          if (judge(i, c1) && judge(c2, j)) {
            ans = (ans + dfs(stt + 1, nd - 1, c1, c2)) % 1000000007;
          }
        }
    }
  } else if (k < nd) {
    for (int c1 = 0; c1 < 3; ++c1)
      for (int c2 = 0; c2 < 3; ++c2) {
        if (judge(c1, c2)) {
          ans = (ans + dfs(stt, k, i, c1) * dfs(k + 1, nd, c2, j)) % 1000000007;
        }
      }
  }
  return dp[stt][nd][i][j] = ans;
}
int main() {
  scanf("%s", bar);
  long long ans = 0;
  int len = strlen(bar);
  stack<int> st;
  for (int i = 0; i < len; ++i) {
    if (bar[i] == '(')
      st.push(i);
    else {
      to[st.top()] = i;
      st.pop();
    }
  }
  memset(dp, -1, sizeof(dp));
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j) {
      ans = (ans + dfs(0, len - 1, i, j)) % 1000000007;
    }
  printf("%lld\n", ans);
  return 0;
}
