#include <bits/stdc++.h>
using namespace std;
ifstream in;
ofstream out;
const long long kk = 1000;
const long long ml = kk * kk;
const long long mod = 998244353;
const long long inf = ml * ml * ml + 7;
long long n, i, j, ans;
vector<long long> m;
vector<long long> q, c, o;
vector<long long> f, of;
string s;
bool viv = false;
long long obr(long long v, long long mod) {
  long long i = 0;
  long long st = mod - 2;
  vector<long long> bin;
  long long l = 0;
  while (st > 0) {
    bin.push_back(st & 1);
    st /= 2;
    l++;
  }
  vector<long long> sq;
  sq.push_back(v);
  for (i = 1; i < l; i++) {
    long long s = sq.back();
    s *= s;
    s %= mod;
    sq.push_back(s);
  }
  long long ans = 1;
  for (i = 0; i < l; i++)
    if (bin[i]) {
      ans *= sq[i];
      ans %= mod;
    }
  return ans;
}
void prepare() {
  q.push_back(0);
  c.push_back(0);
  o.push_back(0);
  for (auto i : s) {
    q.push_back(q.back());
    o.push_back(o.back());
    c.push_back(c.back());
    if (i == '?') q.back()++;
    if (i == '(') o.back()++;
    if (i == ')') c.back()++;
  }
  f.push_back(1);
  for (long long i = 1; i < 10 * kk; i++)
    f.push_back(f.back() * i), f.back() %= mod;
  for (auto i : f) of.push_back(obr(i, mod));
}
long long C(long long n, long long k) {
  if (k < 0 || k > n) return 0;
  long long res = 1;
  res *= f[n];
  res %= mod;
  res *= of[k];
  res %= mod;
  res *= of[n - k];
  res %= mod;
  return res;
}
void solve(long long kol) {
  long long lq1 = q[kol];
  long long lc1 = c[kol];
  long long lo1 = o[kol];
  long long lq2 = q.back() - lq1;
  long long lc2 = c.back() - lc1;
  long long lo2 = o.back() - lo1;
  if (viv) {
    cout << kol << ": ";
    cout << lq1 << ' ';
    cout << lo1 << ' ';
    cout << lc1 << ' ';
    cout << lq2 << ' ';
    cout << lo2 << ' ';
    cout << lc2 << ' ';
    cout << endl;
  }
  long long lans = 0;
  for (long long i = 0; i <= n; i++) {
    if (s[kol - 1] != ')' && s[kol] != '(' || true) {
      long long vars = 1;
      long long val1 = lq1;
      long long val2 = lq2;
      vars *= C(lq1, i - lo1);
      vars *= C(lq2, i - lc2);
      vars %= mod;
      lans += vars * i;
      lans %= mod;
      if (viv) cout << "On " << kol << ' ' << i << " is " << vars << endl;
    }
  }
  lans %= mod;
  ans += lans;
  if (viv) cout << kol << " first give: " << lans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  prepare();
  for (long long i = 1; i < n; i++) solve(i);
  ans %= mod;
  cout << ans << endl;
  return 0;
}
