#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
char a[707];
long long len, mat[707], d[707][707][3][3], ans;
stack<int> s;
void dp(int i, int j) {
  if (i + 1 == j) {
    for (int k = 1; k < 3; k++) d[i][j][k][0] = d[i][j][0][k] = 1;
    return;
  }
  if (mat[i] == j) {
    dp(i + 1, j - 1);
    for (int u = 0; u < 3; u++)
      for (int v = 0; v < 3; v++) {
        if (u != 1)
          d[i][j][1][0] += d[i + 1][j - 1][u][v], d[i][j][1][0] %= mod;
        if (v != 1)
          d[i][j][0][1] += d[i + 1][j - 1][u][v], d[i][j][0][1] %= mod;
        if (u != 2)
          d[i][j][2][0] += d[i + 1][j - 1][u][v], d[i][j][2][0] %= mod;
        if (v != 2)
          d[i][j][0][2] += d[i + 1][j - 1][u][v], d[i][j][0][2] %= mod;
      }
    return;
  }
  int p = mat[i];
  dp(i, p);
  dp(p + 1, j);
  for (int m = 0; m < 3; m++)
    for (int n = 0; n < 3; n++)
      for (int u = 0; u < 3; u++)
        for (int v = 0; v < 3; v++)
          if (!((u == 1 && v == 1) || (u == 2 && v == 2)))
            d[i][j][m][n] += d[i][p][m][u] * d[p + 1][j][v][n],
                d[i][j][m][n] %= mod;
}
int main() {
  cin >> a;
  len = strlen(a);
  for (int i = 0; i < len; i++)
    if (a[i] == '(')
      s.push(i);
    else {
      mat[i] = s.top();
      mat[s.top()] = i;
      s.pop();
    }
  dp(0, len - 1);
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) ans += d[0][len - 1][i][j], ans %= mod;
  cout << ans;
  return 0;
}
