#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7, siz = 700 + 5;
long long n, match[siz], dp[siz][siz][3][3];
long long go(long long l, long long r, long long cl, long long cr) {
  if (l > n or l > r) return 1;
  if (dp[l][r][cl][cr] != -1) return dp[l][r][cl][cr];
  long long ret = 0;
  long long d = match[l];
  if (d == r) {
    for (long long i = 0; i < 3; i++) {
      for (long long j = 0; j < 3; j++) {
        if (i == j) continue;
        if ((i != 0 and i == cl) or (j != 0 and j == cr)) continue;
        if (i > 0 and j > 0) continue;
        ret += go(l + 1, r - 1, i, j);
        ret %= mod;
      }
    }
    return dp[l][r][cl][cr] = ret;
  }
  for (long long i = 0; i < 3; i++) {
    for (long long j = 0; j < 3; j++) {
      if (i == j) continue;
      if (i > 0 and j > 0) continue;
      if ((i != 0 and i == cl)) continue;
      long long cur = go(l + 1, d - 1, i, j) * go(d + 1, r, j, cr);
      cur %= mod;
      ret += cur;
      ret %= mod;
    }
  }
  return dp[l][r][cl][cr] = ret;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  n = s.size();
  s = "0" + s;
  stack<long long> st;
  for (long long i = 1; i <= n; i++) {
    if (s[i] == '(')
      st.push(i);
    else {
      match[st.top()] = i;
      st.pop();
    }
  }
  memset(dp, -1, sizeof dp);
  cout << go(1, n, 0, 0) << endl;
}
