#include <bits/stdc++.h>
using namespace std;
int sum[3005][3005];
long long pot[3005], dp[3005][3005];
long long mod = 998244353;
string s;
long long solve(int esq, int dir) {
  if (esq == dir) return 0;
  if (esq + 1 == dir) return (s[esq] != ')' and s[dir] != '(');
  if (dp[esq][dir] != -1) return dp[esq][dir];
  long long res = 0;
  if (s[esq] != '(') res = (res + solve(esq + 1, dir)) % mod;
  if (s[dir] != ')') res = (res + solve(esq, dir - 1)) % mod;
  if (s[esq] != '(' and s[dir] != ')')
    res = (res - solve(esq + 1, dir - 1) + mod) % mod;
  if (s[esq] != ')' and s[dir] != '(')
    res = (res + solve(esq + 1, dir - 1) + pot[sum[esq + 1][dir - 1]]) % mod;
  return dp[esq][dir] = res;
}
int main() {
  memset(dp, -1, sizeof dp);
  cin >> s;
  int n = s.size(), res = 0;
  for (int i = 0; i < n; i++) {
    int tot = 0;
    for (int j = i; j < n; j++) {
      tot += s[j] == '?';
      sum[i][j] = tot;
    }
  }
  pot[0] = 1;
  for (int i = 1; i <= 2000; i++) pot[i] = (pot[i - 1] * 2) % mod;
  cout << solve(0, n - 1) << endl;
  return 0;
}
