#include <bits/stdc++.h>
using namespace std;
string str;
int memo[777][777][4][4];
int cls[777];
int st[777], top;
int dp(int b, int e, int cb, int ce) {
  int &ret = memo[b][e][cb][ce];
  if (b > e) return 1;
  if (ret != -1) return ret;
  ret = 0;
  int cl = cls[b];
  for (int c = 1; c < 3; c++) {
    if (cl < e || c != ce)
      ret = (ret + (long long)dp(b + 1, cl - 1, 0, c) * dp(cl + 1, e, c, ce)) %
            1000000007;
    if (c != cb)
      ret = (ret + (long long)dp(b + 1, cl - 1, c, 0) * dp(cl + 1, e, 0, ce)) %
            1000000007;
  }
  return ret % 1000000007;
}
int main() {
  memset(memo, -1, sizeof(memo));
  cin >> str;
  top = 0;
  for (int i = 0; i < str.length(); i++) {
    if (str[i] == '(')
      st[++top] = i;
    else
      cls[st[top--]] = i;
  }
  cout << dp(0, str.length() - 1, 0, 0) << endl;
  return 0;
}
