#include <bits/stdc++.h>
using namespace std;
const long long maxn = 705;
const long long mod = 1000000007;
long long dp[maxn][maxn][3][3];
bool vis[maxn][maxn];
long long L[maxn];
char s[maxn];
inline void dfs(long long l, long long r) {
  if (vis[l][r]) return;
  vis[l][r] = true;
  if (l == r - 1) {
    dp[l][r][1][0] = dp[l][r][0][1] = dp[l][r][0][2] = dp[l][r][2][0] = 1;
    return;
  }
  if (L[l] == r) {
    dfs(l + 1, r - 1);
    for (long long i = 0; i <= 2; ++i) {
      for (long long j = 0; j <= 2; ++j) {
        if (i != 1) (dp[l][r][1][0] += dp[l + 1][r - 1][i][j]) %= mod;
        if (i != 2) (dp[l][r][2][0] += dp[l + 1][r - 1][i][j]) %= mod;
        if (j != 1) (dp[l][r][0][1] += dp[l + 1][r - 1][i][j]) %= mod;
        if (j != 2) (dp[l][r][0][2] += dp[l + 1][r - 1][i][j]) %= mod;
      }
    }
  } else {
    dfs(l, L[l]);
    dfs(L[l] + 1, r);
    for (long long a = 0; a <= 2; ++a)
      for (long long b = 0; b <= 2; ++b)
        for (long long c = 0; c <= 2; ++c)
          for (long long d = 0; d <= 2; ++d)
            if (!b || !c || b != c)
              (dp[l][r][a][d] +=
               dp[l][L[l]][a][b] * dp[L[l] + 1][r][c][d] % mod) %= mod;
  }
}
long long sta[maxn];
long long Top;
signed main() {
  scanf("%s", s + 1);
  long long len = strlen(s + 1);
  Top = 0;
  for (long long i = 1; i <= len; ++i) {
    if (s[i] == '(')
      sta[++Top] = i;
    else
      L[sta[Top--]] = i;
  }
  dfs(1, len);
  long long ans = 0;
  for (long long i = 0; i <= 2; ++i)
    for (long long j = 0; j <= 2; ++j) (ans += dp[1][len][i][j]) %= mod;
  printf("%lld\n", ans);
  return 0;
}
