#include <bits/stdc++.h>
using namespace std;
const int N = 705;
const int mod = 1e9 + 7;
int dp[N][N][3][3], n, ans, match[N], match1[N];
string s;
stack<int> st;
int f(int l, int r, int color1, int color2) {
  if (dp[l][r][color1][color2] >= 0) return dp[l][r][color1][color2];
  dp[l][r][color1][color2] = 0;
  if (l + 1 == r) {
    int num = (color1 > 0) + (color2 > 0);
    if (num < 1 || num >= 2) return 0;
    if (color1 != color2) {
      dp[l][r][color1][color2] = 1;
      return 1;
    } else
      return 0;
  }
  if (match[l] == r) {
    int num = (color1 > 0) + (color2 > 0);
    if (num < 1 || num >= 2) return 0;
    if (color1 >= 1 && color2 >= 1 && color1 == color2) return 0;
    for (int i = 0; i <= 2; i++) {
      for (int j = 0; j <= 2; j++) {
        if (i > 0)
          if (i == color1) continue;
        if (j > 0)
          if (j == color2) continue;
        dp[l][r][color1][color2] += f(l + 1, r - 1, i, j);
        dp[l][r][color1][color2] %= mod;
      }
    }
  } else {
    int left, right;
    if (color1 == 0)
      left = 1, right = 2;
    else
      left = 0, right = 0;
    int id = match[l];
    for (int i = left; i <= right; i++) {
      for (int j = 0; j <= 2; j++) {
        if (i > 0 && j > 0)
          if (i == j) continue;
        dp[l][r][color1][color2] +=
            (1ll * f(l, id, color1, i) * 1ll * f(id + 1, r, j, color2)) % mod;
        dp[l][r][color1][color2] %= mod;
      }
    }
  }
  return dp[l][r][color1][color2];
}
int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  cin >> s;
  int n = s.length();
  s = "+" + s;
  for (int i = 1; i <= n; i++) {
    if (s[i] == '(')
      st.push(i);
    else {
      match[st.top()] = i;
      match1[i] = st.top();
      st.pop();
    }
  }
  for (int i = 0; i <= 700; i++) {
    for (int j = 0; j <= 700; j++) {
      for (int k = 0; k <= 2; k++) {
        for (int l = 0; l <= 2; l++) dp[i][j][k][l] = -1;
      }
    }
  }
  for (int i = 0; i <= 2; i++) {
    for (int j = 0; j <= 2; j++) {
      ans += f(1, n, i, j);
      ans %= mod;
    }
  }
  cout << ans << "\n";
}
