#include <bits/stdc++.h>
using namespace std;
int dp1[2000][2];
int dp2[2000][2];
long long C[2001][2001] = {0};
long long choose(int n, int k) {
  if (n < k || n < 0 || k < 0) return 0;
  return C[n][k];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string str;
  cin >> str;
  C[0][0] = 1;
  for (int i = 1; i <= str.size(); i++) {
    for (int j = i; j > 0; j--) {
      C[i][j] =
          (C[i - 1][j] % 998244353 + C[i - 1][j - 1] % 998244353) % 998244353;
    }
    C[i][0] = 1;
  }
  int n1 = 0, n2 = 0;
  for (int i = 0; i < str.size(); i++) {
    if (str[i] == '(') {
      n1++;
    } else if (str[i] == '?') {
      n2++;
    }
    dp1[i][0] = n1;
    dp1[i][1] = n2;
  }
  n1 = 0;
  n2 = 0;
  for (int i = str.size() - 1; i >= 0; i--) {
    dp2[i][0] = n1;
    dp2[i][1] = n2;
    if (str[i] == ')') {
      n1++;
    } else if (str[i] == '?') {
      n2++;
    }
  }
  long long a = 0;
  for (int d = 1; d < str.size() / 2 + 2; d++) {
    for (int i = 0; i < str.size(); i++) {
      long long p = (choose(dp1[i][1], d - dp1[i][0]) *
                     choose(dp2[i][1], d - dp2[i][0])) %
                    998244353;
      p = (p * (long long)d) % 998244353;
      a = (a + p) % 998244353;
    }
  }
  cout << a << endl;
  return 0;
}
