#include <bits/stdc++.h>
using namespace std;
constexpr int P = 998244353;
int power(int a, int b) {
  int result = 1;
  while (b > 0) {
    if (b & 1) result = 1LL * result * a % P;
    a = 1LL * a * a % P;
    b >>= 1;
  }
  return result;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string s;
  cin >> s;
  int n = s.length();
  vector<int> fac(n + 1), invFac(n + 1);
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = 1LL * fac[i - 1] * i % P;
  invFac[n] = power(fac[n], P - 2);
  for (int i = n; i >= 1; --i) invFac[i - 1] = 1LL * invFac[i] * i % P;
  auto binom = [&](int n, int m) {
    return 1LL * fac[n] * invFac[m] % P * invFac[n - m] % P;
  };
  int ans = 0;
  for (int i = 1; i < n; ++i) {
    if (s[i - 1] == ')') continue;
    int a = count(s.begin(), s.begin() + i, '(');
    int b = count(s.begin() + i, s.end(), ')');
    int c = count(s.begin(), s.begin() + i, '?');
    int d = count(s.begin() + i, s.end(), '?');
    if (s[i - 1] == '?') {
      ++a;
      --c;
    }
    vector<int> l(n + 1), r(n + 1);
    for (int j = a; j <= a + c; ++j) l[j] = binom(c, j - a);
    for (int j = b; j <= b + d; ++j) r[j] = binom(d, j - b);
    for (int j = n - 1; j >= 0; --j) r[j] = (r[j] + r[j + 1]) % P;
    for (int j = 1; j <= n; ++j) ans = (ans + 1LL * l[j] * r[j]) % P;
  }
  cout << ans << endl;
  return 0;
}
