#include <bits/stdc++.h>
using namespace std;
long long match[777];
long long dp[777][777][3][3];
void fun(long long l, long long d) {
  if (dp[l][d][0][0] != -1) return;
  for (long long i = 0; i <= 2; i++) {
    for (long long j = 0; j <= 2; j++) {
      dp[l][d][i][j] = 0;
    }
  }
  if (l + 1 == d) {
    for (long long i = 0; i <= 2; i++) {
      for (long long j = 0; j <= 2; j++) {
        if (i * j == 0 && i + j != 0) dp[l][d][i][j] = 1;
      }
    }
  }
  if (match[l] == d) {
    fun(l + 1, d - 1);
    for (long long i = 0; i <= 2; i++) {
      for (long long j = 0; j <= 2; j++) {
        if (!(i * j == 0 && i + j != 0)) continue;
        for (long long ii = 0; ii <= 2; ii++) {
          for (long long jj = 0; jj <= 2; jj++) {
            if ((i != ii || i == 0) && (j != jj || j == 0)) {
              dp[l][d][i][j] += dp[l + 1][d - 1][ii][jj];
              dp[l][d][i][j] %= (1000 * 1000 * 1000 + 7);
            }
          }
        }
      }
    }
    return;
  }
  fun(l, match[l]);
  fun(match[l] + 1, d);
  for (long long i = 0; i <= 2; i++) {
    for (long long j = 0; j <= 2; j++) {
      for (long long ii = 0; ii <= 2; ii++) {
        for (long long jj = 0; jj <= 2; jj++) {
          if (j != ii || j == 0) {
            dp[l][d][i][jj] +=
                (dp[l][match[l]][i][j] * dp[match[l] + 1][d][ii][jj]) %
                (1000 * 1000 * 1000 + 7);
            dp[l][d][i][jj] %= (1000 * 1000 * 1000 + 7);
          }
        }
      }
    }
  }
}
int main() {
  stack<long long> s;
  string str;
  cin >> str;
  long long n = str.length();
  for (long long i = 0; i < n; i++) {
    if (str[i] == '(') {
      s.push(i);
    } else {
      match[s.top()] = i;
      match[i] = s.top();
      s.pop();
    }
  }
  memset(dp, -1, sizeof(dp));
  fun(0, n - 1);
  long long ans = 0;
  for (long long i = 0; i <= 2; i++) {
    for (long long j = 0; j <= 2; j++) {
      ans += dp[0][n - 1][i][j];
      ans %= (1000 * 1000 * 1000 + 7);
    }
  }
  printf("%lld\n", ans);
  return 0;
}
