#include <bits/stdc++.h>
using namespace std;
inline long long Getint() {
  char ch = getchar();
  long long x = 0, fh = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') fh = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    (x *= 10) += ch ^ 48;
    ch = getchar();
  }
  return x * fh;
}
const long long mod = 998244353;
const int N = 2005;
int n, su[N];
char s[N];
bool vis[N][N][3][3];
int f[N][N][3][3], pw[N];
inline int Getsu(int l, int r) {
  if (r < l) return 0;
  return su[r] - su[l - 1];
}
inline long long Dfs(int l, int r, int l1, int l2) {
  if (r <= l)
    return 0;
  else if (vis[l][r][l1][l2])
    return f[l][r][l1][l2];
  long long Ans = 0;
  vis[l][r][l1][l2] = 1;
  int li = l1 == 2 ? 0 : l1, ri = l1 == 2 ? 1 : l1;
  int lj = l2 == 2 ? 0 : l2, rj = l2 == 2 ? 1 : l2;
  for (int i = li; i <= ri; i++)
    for (int j = lj; j <= rj; j++) {
      if (i == 1 && j == 0)
        Ans += Dfs(l + 1, r - 1, s[l + 1], s[r - 1]);
      else if (i == 1)
        Ans += Dfs(l + 1, r, l + 1 == r ? j : s[l + 1], j);
      else if (j == 0)
        Ans += Dfs(l, r - 1, i, r - 1 == l ? i : s[r - 1]);
      else
        Ans += Dfs(l + 1, r - 1, s[l + 1], s[r - 1]) + pw[Getsu(l + 1, r - 1)];
    }
  return f[l][r][l1][l2] = Ans % mod;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  pw[0] = 1;
  for (int i = 1; i <= N - 1; i++) pw[i] = pw[i - 1] * 2ll % mod;
  for (int i = 1; i <= n; i++) su[i] = su[i - 1] + (s[i] == '?');
  for (int i = 1; i <= n; i++) s[i] = (s[i] == '(' ? 0 : (s[i] == ')' ? 1 : 2));
  cout << Dfs(1, n, s[1], s[n]) << '\n';
  return 0;
}
