#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
long long int add(long long int a, long long int b,
                  long long int p = 1000000007) {
  a %= p;
  b %= p;
  return (a + b + p) % p;
}
long long int mul(long long int a, long long int b,
                  long long int p = 1000000007) {
  a %= p;
  b %= p;
  return (a * b + p) % p;
}
long long int power(long long int x, long long int n,
                    long long int p = 1000000007) {
  if (x == 0) return 0;
  if (n == 0 || x == 1) return 1LL;
  long long int r = (power(x, n / 2, p)) % p;
  if (n & 1)
    return mul(mul(r, r, p), x, p);
  else
    return mul(r, r, p);
}
long long int inv(long long int x) { return power(x, 1000000007 - 2); }
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else if (a == 0)
    return b;
  else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
pair<int, int> dx[4] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
string s;
bool check[707][707];
vector<int> validIndex[707];
int dp[707][707][3][3];
int get(const int i, const int j, const int cStart, const int cEnd) {
  if (i > j) return 1;
  if (dp[i][j][cStart][cEnd] != -1) return dp[i][j][cStart][cEnd];
  int ans = 0;
  for (auto &index : validIndex[i]) {
    if (index == j) continue;
    for (long long int c = 0; c < 2; c++) {
      if (cStart != c + 1) {
        int cnt = ((long long int)get(i + 1, index - 1, c + 1, 0) *
                   get(index + 1, j, 0, cEnd)) %
                  1000000007;
        ans += cnt;
        if (ans >= 1000000007) ans -= 1000000007;
      }
      int cnt = ((long long int)get(i + 1, index - 1, 0, c + 1) *
                 get(index + 1, j, c + 1, cEnd)) %
                1000000007;
      ans += cnt;
      if (ans >= 1000000007) ans -= 1000000007;
    }
  }
  if (check[i][j]) {
    for (long long int c = 0; c < 2; c++) {
      if (cStart != c + 1) {
        ans += get(i + 1, j - 1, c + 1, 0);
        if (ans >= 1000000007) ans -= 1000000007;
      }
      if (cEnd != c + 1) {
        ans += get(i + 1, j - 1, 0, c + 1);
        if (ans >= 1000000007) ans -= 1000000007;
      }
    }
  }
  return dp[i][j][cStart][cEnd] = ans;
}
bool isBal(string &st) {
  stack<char> s;
  for (auto &i : st) {
    if (i == '(')
      s.push('(');
    else {
      if (s.empty())
        return 0;
      else
        s.pop();
    }
  }
  return (s.size() == 0);
}
void __sol() {
  cin >> s;
  int n = s.size();
  s = '#' + s;
  memset(check, 0, sizeof(check));
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      string temp = s.substr(i, j - i + 1);
      check[i][j] = isBal(temp);
      if (check[i][j]) validIndex[i].emplace_back(j);
    }
  }
  memset(dp, -1, sizeof(dp));
  cout << get(1, n, 0, 0);
}
int main() {
  clock_t time_req = clock();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int tc = 1;
  while (tc--) __sol();
  time_req = clock() - time_req;
  cerr << "Finished in: " << (float)time_req / CLOCKS_PER_SEC << " seconds"
       << endl;
  return 0;
}
