#include <bits/stdc++.h>
using namespace std;
const int n0 = 2003, mod = 998244353;
const int inv = (mod + 1) / 2;
int n, dp[n0][n0], dp_suf[n0][n0];
string s;
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
void sub(int &x, int y) {
  x -= y;
  if (x < 0) x += mod;
}
int f(int i, int j) {
  int res = dp[i][j];
  if (s[i - 1] == '?' || s[i - 1] == ')') sub(res, dp[i - 1][j]);
  return res;
}
int f_suf(int i, int j) {
  int res = dp_suf[i][j];
  if (s[i - 1] == '?' || s[i - 1] == '(') sub(res, dp_suf[i + 1][j]);
  return res;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> s;
  n = (int)(s).size();
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (s[i - 1] == '?' || s[i - 1] == ')') add(dp[i][j], dp[i - 1][j]);
      if (j > 0 && (s[i - 1] == '?' || s[i - 1] == '('))
        add(dp[i][j], dp[i - 1][j - 1]);
    }
  }
  dp_suf[n + 1][0] = 1;
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j <= n - i + 1; j++) {
      if (s[i - 1] == '?' || s[i - 1] == '(')
        add(dp_suf[i][j], dp_suf[i + 1][j]);
      if (j > 0 && (s[i - 1] == '?' || s[i - 1] == ')'))
        add(dp_suf[i][j], dp_suf[i + 1][j - 1]);
    }
  }
  int ans = 0;
  for (int k = 1; k <= n / 2; k++) {
    int cur = 0, ways = 1;
    for (int j = 1; j <= n; j++) {
      add(cur, (long long)f_suf(j, k) * ways % mod);
      if (s[j - 1] == '?') ways = ways * 2 % mod;
    }
    for (int j = 1; j <= n; j++) {
      sub(cur, f_suf(j, k));
      if (s[j - 1] == '?') cur = (long long)cur * inv % mod;
      add(ans, (long long)f(j, k) * cur % mod);
    }
  }
  cout << ans;
}
