#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int MOD = 998244353;
const int N = 2e3 + 7;
int dp[N][N], bin[N], q[N];
string s;
int add(int x, int y) {
  int res = ((long long)x + y) % MOD;
  if (res < 0) res += MOD;
  return res;
}
int mul(int x, int y) { return (long long)x * y % MOD; }
int get(int x, int y) {
  if (x > y) return 0;
  return q[y] - q[x - 1];
}
int solve(int l, int r) {
  if (l >= r) return 0;
  if (dp[l][r] != -1) return dp[l][r];
  int& ans = dp[l][r] = 0;
  if (s[l - 1] != '(') ans = add(ans, solve(l + 1, r));
  if (s[r - 1] != ')') ans = add(ans, solve(l, r - 1));
  auto k = get(l + 1, r - 1);
  auto nxt = solve(l + 1, r - 1);
  if (s[l - 1] != '(' && s[r - 1] != ')') ans = add(ans, -nxt);
  if (s[l - 1] != ')' && s[r - 1] != '(') {
    ans = add(ans, nxt);
    ans = add(ans, bin[k]);
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tt = clock();
  cin >> s;
  bin[0] = 1;
  for (int i = 1; i <= s.size(); ++i) {
    bin[i] = mul(2, bin[i - 1]);
  }
  for (int i = 1; i <= s.size(); ++i) {
    if (s[i - 1] == '?') {
      q[i] = q[i - 1] + 1;
    } else
      q[i] = q[i - 1];
  }
  for (int i = 0; i <= s.size(); ++i) {
    cerr << q[i] << " \n"[i == s.size()];
  }
  memset(dp, -1, sizeof dp);
  cout << solve(1, s.size()) << '\n';
  cerr << "TIME = " << (double)1.0 * (clock() - tt) / CLOCKS_PER_SEC
       << " seconds" << endl;
  return 0;
}
