#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int gcd(int a, int b, int& x, int& y) {
  if (!a) {
    x = 0, y = 1;
    return b;
  }
  int xx, yy, g = gcd(b % a, a, xx, yy);
  x = yy - b / a * xx;
  y = xx;
  return g;
}
inline int normal(int n) {
  n %= mod;
  (n < 0) && (n += mod);
  return n;
}
inline int inv(int a) {
  int x, y;
  assert(gcd(a, mod, x, y) == 1);
  return normal(x);
}
inline int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
inline int sub(int a, int b) { return a - b < 0 ? a - b + mod : a - b; }
inline int mul(int a, int b) { return int(a * 1ll * b % mod); }
inline int _div(int a, int b) { return mul(a, inv(b)); }
inline int binPow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = mul(ans, a);
    a = mul(a, a);
    b >>= 1;
  }
  return ans;
}
int dp[2222][2222];
int kol[2222];
int k(int l, int r) {
  if (l > r) return 0;
  if (!l) return kol[r];
  return kol[r] - kol[l - 1];
}
int main() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < s.length(); i++) {
    int u = 0;
    if (i) u = kol[i - 1];
    kol[i] = u + (s[i] == '?');
  }
  for (int l = 1; l <= n; l++) {
    for (int i = 0; i + l <= n; i++) {
      int j = i + l - 1;
      if (l == 1) {
        dp[i][j] = 0;
      } else {
        if (s[i] == ')' || s[i] == '?') {
          dp[i][j] = add(dp[i][j], dp[i + 1][j]);
        }
        if (s[i] == '?' || s[i] == '(') {
          if (s[j] == ')' || s[j] == '?') {
            dp[i][j] = add(dp[i][j],
                           add(dp[i + 1][j - 1], binPow(2, k(i + 1, j - 1))));
          }
          if (s[j] == '(' || s[j] == '?') {
            dp[i][j] = add(dp[i][j], dp[i][j - 1]);
            if (s[i] == '?') dp[i][j] = sub(dp[i][j], dp[i + 1][j - 1]);
          }
        }
      }
    }
  }
  cout << dp[0][n - 1];
  return 0;
}
