#include <bits/stdc++.h>
inline long long read() {
  long long x = 0, f = 1;
  char c = ' ';
  for (; c > '9' || c < '0'; c = getchar()) {
    if (c == '-') f = -1;
  }
  for (; c >= '0' && c <= '9'; c = getchar()) {
    x = x * 10 + c - '0';
  }
  return x * f;
}
int dp[2005][2005], f[2005];
char s[2005];
const int mod = 998244353;
inline int q_pow(int x, int t) {
  int s = 1;
  for (; t; t >>= 1, x = 1ll * x * x % mod) {
    if (t & 1) s = 1ll * s * x % mod;
  }
  return s;
}
inline void work() {
  scanf("%s", s);
  int n = strlen(s);
  f[0] = s[0] == '?';
  for (int i = 0; i < n; i++) {
    f[i + 1] = f[i];
    f[i + 1] += s[i] == '?';
  }
  for (int len = 1; len < n; len++) {
    for (int i = 0; i + len < n; i++) {
      int j = i + len;
      if (s[i] != '(') {
        dp[i][j] += dp[i + 1][j];
        dp[i][j] -= dp[i][j] >= mod ? mod : 0;
      }
      if (s[j] != ')') {
        dp[i][j] += dp[i][j - 1];
        dp[i][j] -= dp[i][j] >= mod ? mod : 0;
      }
      if (s[i] != '(' && s[j] != ')') {
        dp[i][j] -= dp[i + 1][j - 1];
        dp[i][j] += dp[i][j] < 0 ? mod : 0;
      }
      if (s[i] != ')' && s[j] != '(') {
        dp[i][j] += dp[i + 1][j - 1];
        dp[i][j] -= dp[i][j] >= mod ? mod : 0;
        dp[i][j] += q_pow(2, f[j] - f[i + 1]);
        dp[i][j] -= dp[i][j] >= mod ? mod : 0;
      }
    }
  }
  printf("%d\n", dp[0][n - 1]);
}
int main() {
  work();
  return 0;
}
