#include <bits/stdc++.h>
using namespace std;
const long long P = 1000000007;
long long n, p[705], dp[705][705][3][3];
char c[705];
stack<long long> s;
inline void dfs(long long l, long long r) {
  if (l + 1 >= r)
    return (void)(dp[l][r][0][1] = dp[l][r][0][2] = dp[l][r][1][0] =
                      dp[l][r][2][0] = 1);
  if (p[r] == l) {
    dfs(l + 1, r - 1);
    for (long long i = 0; i <= 2; i++)
      for (long long j = 0; j <= 2; j++)
        for (long long k = 0; k <= 2; k++)
          for (long long g = 0; g <= 2; g++)
            if ((!k ^ !g) && (!k || !i || k != i) && (!j || !g || j != g))
              (dp[l][r][k][g] += dp[l + 1][r - 1][i][j]) %= P;
  } else {
    dfs(l, p[r] - 1), dfs(p[r], r);
    for (long long i = 0; i <= 2; i++)
      for (long long j = 0; j <= 2; j++)
        for (long long k = 0; k <= 2; k++)
          for (long long g = 0; g <= 2; g++)
            if (!j || j != k)
              (dp[l][r][i][g] +=
               1ll * dp[l][p[r] - 1][i][j] * dp[p[r]][r][k][g] % P) %= P;
  }
}
signed main() {
  scanf("%s", c + 1), n = strlen(c + 1), memset(dp, 0, sizeof(dp));
  long long r = 0;
  for (long long i = 1; i <= n; i++)
    if (c[i] == '(')
      s.push(i);
    else
      p[i] = s.top(), s.pop();
  dfs(1, n);
  for (long long i = 0; i <= 2; i++)
    for (long long j = 0; j <= 2; j++) (r += dp[1][n][i][j]) %= P;
  return printf("%lld\n", r), 0;
}
