#include <bits/stdc++.h>
using namespace std;
char s[1000005];
int n, cntl[1000005], cntr[1000005], cntq[1000005];
int fac[2005], nev[2005], ans, sum[2005][2005];
int C(int n, int m) {
  return (int)(1LL * fac[n] * nev[m] % 998244353 * nev[n - m] % 998244353);
}
int fpm(int x, int y) {
  int r = 1;
  while (y) {
    if (y & 1) r = 1LL * r * x % 998244353;
    x = 1LL * x * x % 998244353;
    y >>= 1;
  }
  return r;
}
int main() {
  ans = 0;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  fac[0] = nev[0] = 1;
  for (int i = 1; i <= n; i++)
    fac[i] = 1LL * fac[i - 1] * i % 998244353,
    nev[i] = fpm(fac[i], 998244353 - 2);
  for (int i = 0; i <= n; i++) {
    sum[i][i] = 1;
    for (int j = i - 1; j >= 0; j--)
      sum[i][j] = (sum[i][j + 1] + C(i, j)) % 998244353;
  }
  s[n + 1] = ')';
  s[0] = '(';
  cntl[0] = 1, cntr[0] = 0, cntq[0] = 0;
  for (int i = 1; i <= n + 1; i++) {
    cntl[i] = cntl[i - 1] + (s[i] == '(' ? 1 : 0);
    cntr[i] = cntr[i - 1] + (s[i] == ')' ? 1 : 0);
    cntq[i] = cntq[i - 1] + (s[i] == '?' ? 1 : 0);
  }
  for (int i = 1; i <= n + 1; i++) {
    if (s[i] == '(') continue;
    int rqnum = cntq[n + 1] - cntq[i];
    int rnum = cntr[n + 1] - cntr[i] + 1;
    int lnum = cntl[i - 1];
    int lqnum = cntq[i - 1];
    for (int j = 0; j <= rqnum; j++) {
      int st = max(rnum + j - lnum, 0);
      if (st <= lqnum)
        ans =
            (1LL * C(rqnum, j) * sum[lqnum][st] % 998244353 + ans) % 998244353;
    }
  }
  printf("%d\n", (ans + 998244353 - fpm(2, cntq[n + 1])) % 998244353);
  return 0;
}
