#include <bits/stdc++.h>
using namespace std;
long long pri[705], dp[705][705][3][3];
long long ans[3][3];
long long cnt(long long l, long long r, long long leftC, long long rightC) {
  if (l > r) return 1;
  if (l + 1 == r) return ans[leftC][rightC];
  if (dp[l][r][leftC][rightC] != -1) return dp[l][r][leftC][rightC];
  long long &res = dp[l][r][leftC][rightC];
  res = 0;
  long long mid = pri[l];
  for (long long i = 0; i < 3; i++) {
    for (long long j = 0; j < 3; j++) {
      if (leftC && i == leftC) continue;
      if (mid == r && j == rightC && rightC) continue;
      if (i + j == 0) continue;
      if (i && j) continue;
      res += cnt(l + 1, mid - 1, i, j) * cnt(mid + 1, r, j, rightC);
      res %= 1000000007;
    }
  }
  return res;
}
int main() {
  long long n, i, j, k, p, q, x, y;
  string s;
  stack<int> st;
  ans[0][0] = 4, ans[0][1] = 3, ans[0][2] = 3;
  ans[1][0] = 3, ans[1][1] = 2, ans[1][2] = 2;
  ans[2][0] = 3, ans[2][1] = 2, ans[2][2] = 2;
  cin >> s;
  n = s.size();
  for (i = 0; i < n; i++) {
    if (s[i] == '(')
      st.push(i);
    else {
      j = st.top();
      st.pop();
      pri[j] = i;
    }
  }
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", cnt(0, n - 1, 0, 0));
  return 0;
}
