#include <bits/stdc++.h>
const int mod = 1e9 + 7;
long long dp[777][777][3][3];
int match[777];
int stack[777];
char str[777];
int len;
void make_match() {
  int top = 0;
  for (int i = 0; i < len; i++) {
    if (str[i] == '(') {
      stack[top++] = i;
    } else {
      match[i] = stack[top - 1];
      match[stack[top - 1]] = i;
      top--;
    }
  }
}
void dfs(int l, int r) {
  if (l + 1 == r) {
    dp[l][r][0][1] = 1;
    dp[l][r][0][2] = 1;
    dp[l][r][1][0] = 1;
    dp[l][r][2][0] = 1;
    return;
  }
  if (match[l] == r) {
    dfs(l + 1, r - 1);
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        if (j != 1)
          dp[l][r][0][1] = (dp[l][r][0][1] + dp[l + 1][r - 1][i][j]) % mod;
        if (i != 1)
          dp[l][r][1][0] = (dp[l][r][1][0] + dp[l + 1][r - 1][i][j]) % mod;
        if (j != 2)
          dp[l][r][0][2] = (dp[l][r][0][2] + dp[l + 1][r - 1][i][j]) % mod;
        if (i != 2)
          dp[l][r][2][0] = (dp[l][r][2][0] + dp[l + 1][r - 1][i][j]) % mod;
      }
    }
  } else {
    int loc = match[l];
    dfs(l, loc);
    dfs(loc + 1, r);
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
          for (int p = 0; p < 3; p++) {
            if (!((k == 1 && p == 1) || (k == 2 && p == 2))) {
              dp[l][r][i][j] =
                  (dp[l][r][i][j] +
                   (dp[l][loc][i][k] * dp[loc + 1][r][p][j]) % mod) %
                  mod;
            }
          }
        }
      }
    }
  }
  return;
}
int main() {
  scanf("%s", str);
  len = (int)strlen(str);
  memset(dp, 0, sizeof(dp));
  memset(match, 0, sizeof(match));
  make_match();
  dfs(0, len - 1);
  long long ans = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      ans = (ans + dp[0][len - 1][i][j]) % mod;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
