#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int v[710], d[710][710][3][3], q[710];
char sir[710];
pair<int, int> decod(int x) {
  pair<int, int> p;
  if (x == 0 || x == 1 || x == 4)
    p.first = 0;
  else if (x == 2 || x == 5)
    p.first = 1;
  else if (x == 3 || x == 6)
    p.first = 2;
  if (x == 2 || x == 3 || x == 4)
    p.second = 0;
  else if (x == 0 || x == 5)
    p.second = 1;
  else if (x == 1 || x == 6)
    p.second = 2;
  return p;
}
int cod(int x, int y) {
  if (x == 0 && y == 1)
    return 0;
  else if (x == 0 && y == 2)
    return 1;
  else if (x == 1 && y == 0)
    return 2;
  else if (x == 2 && y == 0)
    return 3;
  else if (x == 0 && y == 0)
    return 4;
  else if (x == 1 && y == 1)
    return 5;
  else if (x == 2 && y == 2)
    return 6;
}
int bun(int x, int y) {
  if (x > 0 && y > 0 && x == y) return 0;
  return 1;
}
int main() {
  scanf("%s", sir + 1);
  int n = strlen(sir + 1), nr = 0;
  for (int i = 1; i <= n; i++)
    if (sir[i] == '(')
      q[++nr] = i;
    else {
      v[q[nr]] = i;
      v[i] = q[nr];
      nr--;
    }
  for (int i = 1; i <= n; i++)
    if (v[i] == i + 1) {
      for (int j = 0; j < 3; j++)
        for (int q = 0; q < 3; q++)
          if (j * q == 0 && (j || q)) d[i][i + 1][j][q] = 1;
    }
  for (int i = 4; i <= n; i += 2) {
    int lim = n - i + 1;
    for (int j = 1; j <= lim; j++)
      if (sir[j] == '(' && sir[j + i - 1] == ')') {
        if (v[j] == j + i - 1) {
          for (int q = 0; q < 3; q++)
            for (int k = 0; k < 3; k++)
              if (q * k == 0 && (q || k)) {
                for (int q1 = 0; q1 < 3; q1++)
                  for (int k1 = 0; k1 < 3; k1++)
                    if (bun(q, q1) && bun(k1, k))
                      d[j][j + i - 1][q][k] = (d[j][j + i - 1][q][k] +
                                               d[j + 1][j + i - 2][q1][k1]) %
                                              mod;
              }
        } else {
          int x = v[j];
          for (int q = 0; q < 3; q++)
            for (int k = 0; k < 3; k++)
              if (q * k == 0 && (q || k)) {
                for (int q1 = 0; q1 < 3; q1++)
                  for (int k1 = 0; k1 < 3; k1++)
                    if (bun(k, q1))
                      d[j][j + i - 1][q][k1] =
                          (d[j][j + i - 1][q][k1] +
                           1LL * d[j][x][q][k] * d[x + 1][j + i - 1][q1][k1]) %
                          mod;
              }
        }
      }
  }
  int s = 0;
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++) s = (s + d[1][n][i][j]) % mod;
  printf("%d", s);
  return 0;
}
