#include <bits/stdc++.h>
using namespace std;
const int MAXN = 710;
const int MOD = 1000000007;
int n;
int mate[MAXN];
long long int dp[MAXN][MAXN][3][3];
char v[MAXN];
stack<int, vector<int> > s;
long long int solve(int l, int r, int bl, int br) {
  long long int& ans = dp[l][r][bl][br];
  if (ans != -1) return ans;
  if (l > r) return ans = 1;
  ans = 0;
  int mateL = mate[l];
  for (int colorL = 1; colorL <= 2; colorL++) {
    if (colorL == bl) continue;
    long long int left = solve(l + 1, mateL - 1, colorL, 0);
    long long int right = solve(mateL + 1, r, 0, br);
    ans += left * right;
  }
  for (int colorL = 1; colorL <= 2; colorL++) {
    if (mateL == r && colorL == br) continue;
    long long int left = solve(l + 1, mateL - 1, 0, colorL);
    long long int right = solve(mateL + 1, r, colorL, br);
    ans += left * right;
  }
  ans %= MOD;
  return ans;
}
int main() {
  scanf(" %s", v);
  n = strlen(v);
  for (int i = 0; i < n; i++) {
    if (v[i] == '(')
      s.push(i + 1);
    else {
      int p = s.top();
      s.pop();
      mate[p] = i + 1;
      mate[i + 1] = p;
    }
  }
  memset(dp, -1, sizeof(dp));
  printf("%lld\n", solve(1, n, 0, 0));
}
