#include <bits/stdc++.h>
using namespace std;
const long long int N = 200005;
char en = '\n';
long long int inf = 1e16;
long long int mod = 998244353;
long long int power(long long int x, long long int n, long long int mod) {
  long long int res = 1;
  x %= mod;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
long long int fact[N];
long long int ifact[N];
long long int nCr(int n, int r) {
  if (r > n) return 0;
  return fact[n] * ifact[r] % mod * ifact[n - r] % mod;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  fact[0] = ifact[0] = 1;
  for (int i = 1; i < N; i++) {
    fact[i] = (i * fact[i - 1]) % mod;
    ifact[i] = power(fact[i], mod - 2, mod);
  }
  string s;
  cin >> s;
  int n = s.length();
  int suffixWays[n + 5][n + 5];
  memset(suffixWays, 0, sizeof(suffixWays));
  int close = 0, avail = 0;
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == '?')
      avail++;
    else if (s[i] == ')')
      close++;
    for (int noClose = close; noClose <= n; noClose++) {
      suffixWays[i][noClose] = nCr(avail, noClose - close);
    }
    for (int noClose = n - 1; noClose >= 0; noClose--) {
      suffixWays[i][noClose] += suffixWays[i][noClose + 1];
      if (suffixWays[i][noClose] >= mod) suffixWays[i][noClose] -= mod;
    }
  }
  int res = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == ')') continue;
    int leftAvail = 0, leftOpen = 0;
    for (int j = 0; j < i; j++) {
      if (s[j] == '?')
        leftAvail++;
      else if (s[j] == '(')
        leftOpen++;
    }
    for (int open = leftOpen; open <= leftOpen + leftAvail; open++) {
      res += (long long int)nCr(leftAvail, open - leftOpen) *
             suffixWays[i + 1][open + 1] % mod;
      if (res >= mod) res -= mod;
    }
  }
  cout << res << en;
  return 0;
}
