#include <bits/stdc++.h>
using namespace std;
const int maxn = 710;
long long MOD = 1000000007;
long long dp[maxn][maxn][3][3];
int match[maxn], st[maxn];
string s;
void init() {
  cin >> s;
  memset(match, 0, sizeof(match));
  memset(dp, 0, sizeof(dp));
  int top = 0;
  for (int i = 0; i < s.size(); i++)
    if (s[i] == '(') {
      top++;
      st[top] = i;
    } else {
      match[i] = st[top];
      match[st[top]] = i;
      top--;
    }
}
void work(int l, int r) {
  if (l + 1 == r) {
    dp[l][r][1][0] = dp[l][r][2][0] = dp[l][r][0][1] = dp[l][r][0][2] = 1;
    return;
  }
  if (match[l] == r) {
    work(l + 1, r - 1);
    for (int i = 0; i <= 2; i++)
      for (int j = 0; j <= 2; j++) {
        if (i != 1)
          dp[l][r][1][0] = (dp[l][r][1][0] + dp[l + 1][r - 1][i][j]) % MOD;
        if (i != 2)
          dp[l][r][2][0] = (dp[l][r][2][0] + dp[l + 1][r - 1][i][j]) % MOD;
        if (j != 1)
          dp[l][r][0][1] = (dp[l][r][0][1] + dp[l + 1][r - 1][i][j]) % MOD;
        if (j != 2)
          dp[l][r][0][2] = (dp[l][r][0][2] + dp[l + 1][r - 1][i][j]) % MOD;
      }
  } else {
    work(l, match[l]);
    work(match[l] + 1, r);
    for (int i = 0; i <= 2; i++)
      for (int j = 0; j <= 2; j++)
        for (int p = 0; p <= 2; p++)
          for (int q = 0; q <= 2; q++) {
            if ((j == 1 && p == 1) || (j == 2 && p == 2)) continue;
            dp[l][r][i][q] = (dp[l][r][i][q] + dp[l][match[l]][i][j] *
                                                   dp[match[l] + 1][r][p][q]) %
                             MOD;
          }
  }
}
int main() {
  init();
  work(0, s.size() - 1);
  long long ans = 0;
  for (int i = 0; i <= 2; i++)
    for (int j = 0; j <= 2; j++) ans = (ans + dp[0][s.size() - 1][i][j]) % MOD;
  printf("%lld\n", ans);
  return 0;
}
