#include <bits/stdc++.h>
using namespace std;
const int N = 705, mod = 1e9 + 7;
int n;
int f[N][N][3][3], pos[N];
char ch[N];
int dp(int l, int r, int cl, int cr) {
  if (l > r) return cl != cr || (cl == 0 && cr == 0);
  if (f[l][r][cl][cr] != -1) return f[l][r][cl][cr];
  int res = 0;
  if (pos[l] == -1) {
    int sum = 1;
    for (int i = l + 1; i <= n; i++)
      if (ch[i] == '(')
        sum++;
      else {
        sum--;
        if (!sum) {
          pos[l] = i;
          break;
        }
      }
  }
  if (pos[l] == l + 1) {
    if (cl != 1) res = (res + dp(l + 2, r, 0, cr)) % mod;
    if (cl != 2) res = (res + dp(l + 2, r, 0, cr)) % mod;
    res = (res + dp(l + 2, r, 1, cr)) % mod;
    res = (res + dp(l + 2, r, 2, cr)) % mod;
    return f[l][r][cl][cr] = res;
  }
  if (pos[l] == r) {
    if (cl != 1) res = (res + dp(l + 1, r - 1, 1, 0)) % mod;
    if (cl != 2) res = (res + dp(l + 1, r - 1, 2, 0)) % mod;
    if (cr != 1) res = (res + dp(l + 1, r - 1, 0, 1)) % mod;
    if (cr != 2) res = (res + dp(l + 1, r - 1, 0, 2)) % mod;
    return f[l][r][cl][cr] = res;
  }
  if (cl != 1)
    res = (res +
           1ll * dp(l + 1, pos[l] - 1, 1, 0) * dp(pos[l] + 1, r, 0, cr) % mod) %
          mod;
  if (cl != 2)
    res = (res +
           1ll * dp(l + 1, pos[l] - 1, 2, 0) * dp(pos[l] + 1, r, 0, cr) % mod) %
          mod;
  res = (res +
         1ll * dp(l + 1, pos[l] - 1, 0, 1) * dp(pos[l] + 1, r, 1, cr) % mod) %
        mod;
  res = (res +
         1ll * dp(l + 1, pos[l] - 1, 0, 2) * dp(pos[l] + 1, r, 2, cr) % mod) %
        mod;
  return f[l][r][cl][cr] = res;
}
int main() {
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  memset(f, -1, sizeof(f));
  memset(pos, -1, sizeof(pos));
  printf("%d", dp(1, n, 0, 0));
  return 0;
}
