#include <bits/stdc++.h>
using namespace std;
const int N = 2001, M = 998244353;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
string s;
int dp[N + 1][N + 1][2], cs[N], p[N + 1];
void add(int &a, int b) {
  a += b;
  if (a >= M) a -= M;
}
int calc(int l, int r, bool ok) {
  if (l >= r) return 0;
  int &ref = dp[l][r][ok];
  if (ref != -1) return ref;
  if (s[l - 1] == ')') return ref = calc(l + 1, r, ok);
  if (s[r - 1] == '(') return ref = calc(l, r - 1, ok);
  ref = calc(l + 1, r - 1, 0);
  add(ref, p[cs[r - 1] - cs[l]]);
  if (s[l - 1] == '?') add(ref, calc(l + 1, r, 1));
  if (!ok && s[r - 1] == '?') add(ref, calc(l, r - 1, 0));
  return ref;
}
int main() {
  cin >> s;
  memset(dp, -1, sizeof dp);
  p[0] = 1;
  for (int i = 1; i <= N; i++) p[i] = 2 * p[i - 1] % M;
  for (int i = 1; i <= s.size(); i++) cs[i] = cs[i - 1] + (s[i - 1] == '?');
  printf("%d\n", calc(1, s.size(), 0));
}
