#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
const int mod = 998244353;
char str[MAXN];
int n;
int power(int a, int n) {
  int ans = 1;
  for (; n; n >>= 1) {
    if (n & 1) ans = (long long)ans * a % mod;
    a = (long long)a * a % mod;
  }
  return ans;
}
struct mint {
  int a;
  mint() { a = 0; }
  mint(int _a) { a = _a; }
  friend mint operator+(const mint &a, const mint &b) {
    return (a.a + b.a) % mod;
  }
  friend mint operator-(const mint &a, const mint &b) {
    return (a.a - b.a) % mod;
  }
  friend mint operator-(const mint &a) { return (-a.a) % mod; }
  friend mint operator*(const mint &a, const mint &b) {
    return (long long)a.a * b.a % mod;
  }
  mint inv() const { return power(a, mod - 2); }
  int to_int() const { return (a + mod) % mod; }
  friend mint operator/(const mint &a, const mint &b) {
    assert(b.a != 0);
    return a * b.inv();
  }
};
vector<mint> fac, ifac, inv;
void combine_init(int N) {
  inv.resize(N + 1);
  fac.resize(N + 1);
  ifac.resize(N + 1);
  inv[1] = 1;
  for (int i = 2; i <= N; i++) {
    inv[i] = mint(-mod / i) * inv[mod % i];
  }
  fac[0] = ifac[0] = 1;
  for (int i = 1; i <= N; i++) {
    fac[i] = fac[i - 1] * i;
    ifac[i] = ifac[i - 1] * inv[i];
  }
}
mint choose(int n, int m) {
  return m <= n ? fac[n] * ifac[m] * ifac[n - m] : 0;
}
vector<int> pre, suf;
vector<int> pre_s, suf_s;
void init_data() {
  pre.resize(n + 1);
  suf.resize(n + 2);
  pre_s.resize(n + 1);
  suf_s.resize(n + 2);
  pre[0] = suf[n + 1] = 0;
  pre_s[0] = suf_s[n + 1] = 0;
  for (int i = 1; i <= n; i++) {
    pre[i] = pre[i - 1] + (str[i] == '(');
    pre_s[i] = pre_s[i - 1] + (str[i] == '?');
  }
  for (int i = n; i >= 1; i--) {
    suf[i] = suf[i + 1] + (str[i] == ')');
    suf_s[i] = suf_s[i + 1] + (str[i] == '?');
  }
}
void work() {
  mint ans = 0;
  for (int i = 1; i < n; i++) {
    int p = pre[i], s = suf[i + 1];
    int ps = pre_s[i], ss = suf_s[i + 1];
    for (int k = 0; k <= n; k++) {
      int ld = k - p;
      int rd = k - s;
      if (ld < 0 || rd < 0) continue;
      if (ld > ps || rd > ss) continue;
      int lx = ld;
      int rx = rd;
      ans = ans + choose(ps, lx) * choose(ss, rx) * (p + lx);
    }
  }
  cout << ans.to_int() << endl;
}
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  combine_init(n);
  init_data();
  work();
  return 0;
}
