#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const double PI = acos(-1);
using namespace std;
const int MAX = 705, mod = 1e9 + 7;
char S[MAX];
int pref[MAX], E[MAX], n, ac;
int dp[MAX][MAX][3][3];
vector<pair<int, int> > cand;
int match[MAX];
bool valid(int s, int e) {
  if (s > e) return 1;
  if (S[s] == ')') return 0;
  return e <= E[s];
}
int solve(int s, int e, int left_color, int right_color) {
  if (s > e) return 1;
  int& ret = dp[s][e][left_color][right_color];
  if (ret != -1) return ret;
  ret = 0;
  int k = match[s];
  for (auto p : cand) {
    int c1 = p.first, c2 = p.second;
    if (c1 && c1 == left_color) continue;
    if (k == e && c2 && c2 == right_color) continue;
    if (!valid(s + 1, k - 1) || !valid(k + 1, e)) continue;
    int f1 = solve(s + 1, k - 1, c1, c2);
    int f2 = solve(k + 1, e, c2, right_color);
    ret = (ac = ret + ((f1 * 1LL * f2) % mod), ac - ((ac >= mod) ? mod : 0));
  }
  return ret;
}
int main() {
  scanf("%s", S);
  n = strlen(S);
  vector<int> ST;
  for (int i = 0; i < (n); i++) {
    if (S[i] == '(')
      ST.push_back(i);
    else {
      match[ST.back()] = i;
      ST.pop_back();
    }
  }
  for (int i = 0; i < n; i++)
    if (S[i] == '(') {
      int j = i, s = 0;
      while (j < n && s >= 0) {
        s += (S[j] == '(') - (S[j] == '(');
        if (s < 0) break;
        if (j + 1 == n) break;
        j++;
      }
      E[i] = j;
    }
  for (int c1 = 0; c1 < (3); c1++)
    for (int c2 = 0; c2 < (3); c2++)
      if ((!c1 || !c2) && (c1 != c2)) {
        cand.push_back(make_pair(c1, c2));
      }
  memset(dp, -1, sizeof dp);
  cout << solve(0, n - 1, 0, 0) << endl;
  return 0;
}
