#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353L;
const int maxn = 2005;
long long c[maxn][maxn];
long long pre[maxn][maxn];
int n;
void init() {
  memset(c, 0, sizeof(c));
  memset(pre, 0, sizeof(pre));
  c[0][0] = 1;
  pre[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    c[i][0] = c[i][i] = 1;
    for (int j = 1; j < i; j++) {
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
    }
    for (int j = i; j >= 0; j--) {
      pre[i][j] = (pre[i][j + 1] + c[i][j]) % mod;
    }
  }
}
long long comb(int x, int y) {
  if (y < 0 || y > x) return 0;
  return c[x][y];
}
long long comb1(int x, int y) {
  y = max(y, 0);
  if (y > x) return 0;
  return pre[x][y];
}
int qc[maxn], lc[maxn], rc[maxn];
char s[maxn];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) {
    qc[i] = qc[i - 1] + (s[i] == '?');
    lc[i] = lc[i - 1] + (s[i] == '(');
    rc[i] = rc[i - 1] + (s[i] == ')');
  }
  init();
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    if (s[i] == ')') continue;
    for (int j = 1; j <= n / 2; j++) {
      long long ans1 = comb(qc[i - 1], (j - 1) - (lc[i - 1]));
      long long ans2 = comb1(qc[n] - qc[i], j - (rc[n] - rc[i]));
      ans = (ans + ans1 * ans2) % mod;
    }
  }
  cout << ans << endl;
  return 0;
}
