#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 705;
const long long MOD = 1000000007;
int n;
char s[MAX_N];
int pereche[MAX_N];
int st[MAX_N], top;
long long dp[MAX_N][MAX_N][3][3];
inline void add_mod(long long& a, long long b) { a = (a + b) % MOD; }
inline bool can_neighbour(int c1, int c2) {
  if (c1 == c2 && c1 > 0) return false;
  return true;
}
inline bool can_pair(int c1, int c2) {
  return (c1 == 0 && c2 > 0) || (c1 > 0 && c2 == 0);
}
long long solve(int a, int b, int c1, int c2) {
  if (dp[a][b][c1][c2] != -1) return dp[a][b][c1][c2];
  dp[a][b][c1][c2] = 0;
  if (pereche[a] == b) {
    if (c1 == 0 && c2 == 0) return dp[a][b][c1][c2] = 0;
    if (c1 > 0 && c2 > 0) return dp[a][b][c1][c2] = 0;
    if (a + 1 == b) return dp[a][b][c1][c2] = 1;
    for (int i = 0; i < 3; ++i)
      for (int j = 0; j < 3; ++j)
        if (can_neighbour(i, c1) && can_neighbour(j, c2))
          add_mod(dp[a][b][c1][c2], solve(a + 1, b - 1, i, j));
    return dp[a][b][c1][c2];
  }
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j)
      if (can_pair(c1, i) && can_neighbour(i, j))
        add_mod(dp[a][b][c1][c2], solve(a, pereche[a], c1, i) *
                                      solve(pereche[a] + 1, b, j, c2) % MOD);
  return dp[a][b][c1][c2];
}
int main() {
  assert(scanf("%s", s + 1) == 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i)
    if (s[i] == '(')
      st[++top] = i;
    else {
      pereche[i] = st[top];
      pereche[st[top]] = i;
      --top;
    }
  memset(dp, -1, sizeof(dp));
  long long sol = 0;
  for (int i = 0; i < 3; ++i)
    for (int j = 0; j < 3; ++j) sol = (sol + solve(1, n, i, j)) % MOD;
  cout << sol;
}
