#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const int INF = 1000000000;
const int MAXN = 1050;
long long dp[N][N][4][4];
const long long mod = 1000000007;
int flag[N];
stack<int> s;
char a[N];
int main() {
  memset(dp, 0, sizeof(dp));
  scanf("%s", a + 1);
  int n = strlen(a + 1);
  for (int i = 1; i <= n; i++) {
    if (a[i] == '(')
      s.push(i);
    else {
      int id = s.top();
      s.pop();
      flag[id] = i, flag[i] = id;
    }
  }
  for (int l = n - 1; l >= 1; l--) {
    dp[l][l + 1][0][1] = 1;
    dp[l][l + 1][0][2] = 1;
    dp[l][l + 1][1][0] = 1;
    dp[l][l + 1][2][0] = 1;
    if (flag[l] != l + 1) {
      dp[l][l + 1][1][2] = 1;
      dp[l][l + 1][2][1] = 1;
      dp[l][l + 1][0][0] = 1;
    }
    for (int r = l + 2; r <= n; r++) {
      if (flag[l] == r) {
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
            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;
            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;
          }
        }
      } else {
        int x = flag[l];
        for (int i = 0; i < 3; i++) {
          for (int j = 0; j < 3; j++) {
            for (int k = 0; k < 3; k++) {
              for (int p = 0; p < 3; p++) {
                if (k == p && k != 0) continue;
                dp[l][r][i][j] +=
                    (dp[l][x][i][k] % mod) * (dp[x + 1][r][p][j] % mod);
                dp[l][r][i][j] %= mod;
              }
            }
          }
        }
      }
    }
  }
  long long sum = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      sum += dp[1][n][i][j];
      sum %= mod;
    }
  }
  cout << sum << endl;
  return 0;
}
