#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
const int MAXN = 2e3 + 100;
long long stab(long long a) { return ((a % MOD + MOD) % MOD); }
array<long long, MAXN> fact;
array<long long, MAXN> obr_fac;
long long pw(long long a, long long b) {
  if (b == 0) {
    return 1;
  } else if (b % 2 == 0) {
    return pw((a * a) % MOD, b / 2);
  } else {
    return (a * pw(a, b - 1)) % MOD;
  }
}
long long obr(long long a) { return pw(a, MOD - 2); }
long long c_n_k[MAXN][MAXN];
int main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  for (int i = 0; i < MAXN; ++i) {
    for (int j = 0; j <= i; ++j) {
      if (min(i - j, j) == 0) {
        c_n_k[i][j] = 1;
      } else if (min(i - j, j) == 1) {
        c_n_k[i][j] = i;
      } else {
        c_n_k[i][j] = (c_n_k[i - 1][j - 1] + c_n_k[i - 1][j]);
        if (c_n_k[i][j] >= MOD) {
          c_n_k[i][j] -= MOD;
        }
      }
    }
  }
  string str;
  cin >> str;
  int n = str.size();
  long long ans = 0;
  for (int i = 0; i <= n; ++i) {
    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;
    for (int j = 0; j < i; ++j) {
      if (str[j] == '(') {
        a++;
      } else if (str[j] == '?') {
        b++;
      }
    }
    for (int j = i; j < n; ++j) {
      if (str[j] == ')') {
        c++;
      } else if (str[j] == '?') {
        d++;
      }
    }
    for (int l = max(a, c); l <= min(a + b, c + d); ++l) {
      ans += (l * ((c_n_k[b][l - a] * c_n_k[d][l - c]) % MOD)) % MOD;
    }
  }
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
