#include <bits/stdc++.h>
using namespace std;
int mod = 998244353;
int main() {
  string s;
  cin >> s;
  int l = s.size();
  vector<vector<int> > nck(l + 1);
  for (int i = 0; i < l + 1; i++) nck[i].resize(l + 1);
  nck[0][0] = 1;
  for (int n = 1; n < l + 1; n++) {
    nck[n][0] = 1;
    for (int k = 1; k < n + 1; k++)
      nck[n][k] = (nck[n - 1][k] + nck[n - 1][k - 1]) % mod;
    for (int k = n + 1; k < l + 1; k++) nck[n][k] = 0;
  }
  vector<int> lefts(l), rights(l), marks(l);
  int ls = 0, rs = 0, qs = 0;
  for (int i = 0; i < l; i++) {
    ls += s[i] == '(' ? 1 : 0;
    rs += s[i] == ')' ? 1 : 0;
    qs += s[i] == '?' ? 1 : 0;
    lefts[i] = ls;
    rights[i] = rs;
    marks[i] = qs;
  }
  long long ans = 0;
  for (int g = 0; g < l; g++) {
    for (int i = 0; i < l; i++) {
      int a = lefts[i];
      int b = rights[l - 1] - rights[i];
      int c = marks[i];
      int d = marks[l - 1] - marks[i];
      if (g >= a && g >= b) {
        ans += ((((long long)nck[c][g - a] * (long long)nck[d][g - b]) % mod) *
                (long long)g) %
               mod;
        ans %= mod;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
