#include <bits/stdc++.h>
const int M = 2005, mo = 998244353;
int pow(int x, int k) {
  int ans = 1;
  while (k) {
    if (k & 1) ans = 1ll * ans * x % mo;
    x = 1ll * x * x % mo;
    k >>= 1;
  }
  return ans;
}
char s[M];
int n, a[M], sum[M], dp[M][M];
void inc(int &x, const int y) {
  x += y;
  if (x >= mo) x -= mo;
}
void dec(int &x, const int y) {
  x -= y;
  if (x < 0) x += mo;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) {
    a[i] = s[i] == '(' ? 1 : (s[i] == ')' ? -1 : 0);
    sum[i] = sum[i - 1] + !a[i];
  }
  memset(dp, 0, sizeof dp);
  for (int k = 2; k <= n; ++k)
    for (int i = 1, j; i <= n - k + 1; ++i) {
      j = i + k - 1;
      if (s[i] != '(') inc(dp[i][j], dp[i + 1][j]);
      if (s[j] != ')') inc(dp[i][j], dp[i][j - 1]);
      if (s[i] != '(' && s[j] != ')') dec(dp[i][j], dp[i + 1][j - 1]);
      if (s[i] != ')' && s[j] != '(')
        inc(dp[i][j], (pow(2, sum[j - 1] - sum[i]) + dp[i + 1][j - 1]) % mo);
    }
  printf("%d", dp[1][n]);
  return 0;
}
