#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long dp[705][705][3][3];
int has[705];
stack<int> st;
void dfs(int l, int r) {
  if (l == r) return;
  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 (has[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;
      }
    }
    return;
  }
  int mid = has[l];
  dfs(l, mid);
  dfs(mid + 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 m = 0; m < 3; m++) {
          if (k == m && k) continue;
          dp[l][r][i][j] += (dp[l][mid][i][k] * dp[mid + 1][r][m][j]) % MOD;
        }
      dp[l][r][i][j] %= MOD;
    }
  return;
}
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  for (int i = 0; s[i]; i++) {
    if (s[i] == '(')
      st.push(i);
    else {
      has[st.top()] = i;
      has[i] = st.top();
      st.pop();
    }
  }
  dfs(0, s.size() - 1);
  long long ans = 0;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) ans += dp[0][s.size() - 1][i][j];
  cout << ans % MOD << '\n';
  return 0;
}
