#include <bits/stdc++.h>
using namespace std;
int dp[705][705][3][3];
int St[705], sz, mark[705];
string str;
void init() {
  int top = -1;
  St[++top] = 0;
  for (int i = 1; i < sz; i++) {
    if (str[i] == ')') {
      mark[St[top]] = i;
      top--;
    } else
      St[++top] = i;
  }
}
long long solve(int l, int r, int i, int j) {
  if (mark[l] == r && (i == j || i * j != 0)) return 0;
  if (l >= r || l + 1 == r) return 1;
  if (dp[l][r][i][j]) return dp[l][r][i][j];
  long long ans = 0;
  for (int m = 0; m < 3; m++) {
    for (int n = 0; n < 3; n++) {
      if (mark[l] == r) {
        if (i != 0 && m == i) continue;
        if (j != 0 && n == j) continue;
        ans = (ans + solve(l + 1, r - 1, m, n)) % 1000000007;
      } else {
        if (m != 0 && n != 0 && m == n) continue;
        long long tmp1 = 0, tmp = solve(l, mark[l], i, m);
        if (tmp) tmp1 = solve(mark[l] + 1, r, n, j);
        tmp = (tmp * tmp1) % 1000000007;
        ans = (ans + tmp);
        if (ans >= 1000000007) ans = ans - 1000000007;
      }
    }
  }
  dp[l][r][i][j] = ans;
  return ans;
}
int main() {
  cin >> str;
  sz = str.size();
  init();
  long long ans = 0;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      ans = (ans + solve(0, sz - 1, i, j)) % 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
