#include <bits/stdc++.h>
using namespace std;
int dp[705][705][3][3];
char s[705];
int close[705];
bool can(int cl, int cr) {
  if (!cl || !cr) return true;
  return cl != cr;
}
int ktra(int cl, int cr) {
  if (cl && cr) return 0;
  if (!cl && !cr) return 0;
  return 1;
}
int dfs(int l, int r, int cl, int cr) {
  int &res = dp[l][r][cl][cr];
  if (res != -1) return res;
  if (l + 1 == r) return res = ktra(cl, cr);
  int i, j;
  res = 0;
  if (close[l] == r) {
    if (ktra(cl, cr) == 0) return 0;
    for ((i) = 0; (i) < (3); (i)++)
      for ((j) = 0; (j) < (3); (j)++)
        if (can(cl, i) && can(j, cr))
          res = (res + dfs(l + 1, r - 1, i, j)) % 1000000007;
  } else {
    int x = close[l], y = x + 1;
    for ((i) = 0; (i) < (3); (i)++)
      for ((j) = 0; (j) < (3); (j)++)
        if (can(i, j))
          res = ((long long)res +
                 (long long)dfs(l, x, cl, i) * (long long)dfs(y, r, j, cr)) %
                1000000007;
  }
  return res;
}
void input() {
  int i, j, len;
  stack<int> st;
  scanf("%s", &s);
  len = strlen(s);
  for ((i) = 0; (i) < (len); (i)++)
    if (s[i] == '(')
      st.push(i);
    else
      close[st.top()] = i, st.pop();
  memset(dp, -1, sizeof(dp));
  int res = 0;
  for ((i) = 0; (i) < (3); (i)++)
    for ((j) = 0; (j) < (3); (j)++)
      res = (res + dfs(0, len - 1, i, j)) % 1000000007;
  printf("%d", res);
}
int main() {
  input();
  return 0;
}
