#include <bits/stdc++.h>
using namespace std;
const long long maxm = 705;
const long long mod = 1e9 + 7;
long long d[maxm][maxm][3][3];
char s[maxm];
long long R[maxm];
long long n;
void dfs(long long l, long long r) {
  if (l + 1 == r) {
    for (long long i = 0; i < 3; i++) {
      for (long long j = 0; j < 3; j++) {
        if (i && j) continue;
        if (!i && !j) continue;
        d[l][r][i][j] = 1;
      }
    }
    return;
  }
  if (R[l] == r) {
    dfs(l + 1, r - 1);
    for (long long i = 0; i < 3; i++) {
      for (long long j = 0; j < 3; j++) {
        if (i && j) continue;
        if (!i && !j) continue;
        for (long long x = 0; x < 3; x++) {
          for (long long y = 0; y < 3; y++) {
            if (i && x && i == x) continue;
            if (j && y && j == y) continue;
            d[l][r][i][j] += d[l + 1][r - 1][x][y];
            d[l][r][i][j] %= mod;
          }
        }
      }
    }
  } else {
    long long p = R[l];
    dfs(l, p), dfs(p + 1, r);
    for (long long i = 0; i < 3; i++) {
      for (long long j = 0; j < 3; j++) {
        for (long long x = 0; x < 3; x++) {
          for (long long y = 0; y < 3; y++) {
            if (j && x && j == x) continue;
            d[l][r][i][y] += d[l][p][i][j] * d[p + 1][r][x][y] % mod;
            d[l][r][i][y] %= mod;
          }
        }
      }
    }
  }
}
signed main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  stack<long long> stk;
  for (long long i = 1; i <= n; i++) {
    if (s[i] == '(')
      stk.push(i);
    else
      R[stk.top()] = i, stk.pop();
  }
  dfs(1, n);
  long long ans = 0;
  for (long long i = 0; i < 3; i++) {
    for (long long j = 0; j < 3; j++) {
      ans = (ans + d[1][n][i][j]) % mod;
    }
  }
  cout << ans << endl;
  return 0;
}
