#include <bits/stdc++.h>
using namespace std;
long long t, dp[1001][1001][4][4], now, x[1001], sum, ans;
string s;
stack<long long> sta;
void dfs(long long l, long long r) {
  if (l + 1 == r) {
    for (long long i = 1; i <= 2; ++i) {
      dp[l][r][i][0] = dp[l][r][0][i] = 1;
    }
    return;
  }
  if (x[l] == r) {
    dfs(l + 1, r - 1);
    for (long long i = 1; i <= 2; ++i) {
      for (long long j = 0; j <= 2; ++j) {
        for (long long k = 0; k <= 2; ++k) {
          if (i != j) {
            dp[l][r][i][0] += dp[l + 1][r - 1][j][k];
            dp[l][r][i][0] %= 1000000007;
          }
          if (i != k) {
            dp[l][r][0][i] += dp[l + 1][r - 1][j][k];
            dp[l][r][0][i] %= 1000000007;
          }
        }
      }
    }
    return;
  }
  for (long long i = l; i <= r; ++i) {
    dfs(i, x[i]);
    i = x[i];
  }
  for (long long i = x[l] + 1; i <= r; ++i) {
    long long last = i - 1;
    i = x[i];
    for (long long j = 0; j <= 2; ++j) {
      for (long long k = 0; k <= 2; ++k) {
        for (long long j1 = 0; j1 <= 2; ++j1) {
          for (long long k1 = 0; k1 <= 2; ++k1) {
            if (j1 != k1 || j1 == 0) {
              dp[l][i][j][k] += dp[l][last][j][j1] * dp[x[i]][i][k1][k];
              dp[l][i][j][k] %= 1000000007;
            }
          }
        }
      }
    }
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin >> s;
  s = ' ' + s;
  for (long long i = 1; i < s.length(); ++i) {
    if (s[i] == '(') {
      sta.push(i);
    } else {
      x[i] = sta.top();
      x[sta.top()] = i;
      sta.pop();
    }
  }
  for (long long i = 1; i < s.length(); ++i) {
    for (long long j = i + 1; j <= s.length(); ++j) {
      for (long long k = 0; k <= 2; ++k) {
        for (long long l = 0; l <= 2; ++l) {
          dp[i][j][k][l] = 0;
        }
      }
    }
  }
  dfs(1, s.length() - 1);
  ans = 0;
  for (long long i = 0; i <= 2; ++i) {
    for (long long j = 0; j <= 2; ++j) {
      ans += dp[1][s.length() - 1][i][j];
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
