#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
using ll = long long;
ll mod = 998244353;
string s;
int n;
ll dp[maxn][maxn];
int pref[maxn];
ll bigmod(ll a, ll b) {
  ll ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ret;
}
ll call(int l, int r) {
  if (l >= r) return 0;
  if (dp[l][r] != -1) return dp[l][r];
  ll ret = 0;
  if (s[l] != '(') {
    ret = (ret + call(l + 1, r)) % mod;
  }
  if (s[r] != ')') {
    ret = (ret + call(l, r - 1)) % mod;
  }
  if (s[l] != '(' && s[r] != ')') {
    ret = (ret - call(l + 1, r - 1) + mod) % mod;
  }
  if (s[l] != ')' && s[r] != '(') {
    ret =
        ((ret + call(l + 1, r - 1) % mod) + bigmod(2, pref[r - 1] - pref[l])) %
        mod;
  }
  return dp[l][r] = ret;
}
int main(int argc, char const *argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> s;
  int n = s.size();
  memset(dp, -1, sizeof dp);
  for (int i = 0; i < n; ++i) {
    pref[i] = (s[i] == '?');
    if (i) {
      pref[i] = pref[i - 1] + pref[i];
    }
  }
  cout << call(0, n - 1) << endl;
  return 0;
}
