#include <bits/stdc++.h>
using namespace std;
long long mod_pow(long long b, int x) {
  if (!x) return 1;
  if (x & 1) return (b * mod_pow(b, x - 1)) % 998244353;
  long long tmp = mod_pow(b, x / 2);
  return (tmp * tmp) % 998244353;
}
char s[2010];
int memo[2010][2010], acum[2010];
long long sum_depths(int l, int r) {
  if (l >= r) return 0;
  if (memo[l][r] != -1) return memo[l][r];
  long long ret = 0;
  if (s[l] != '(') {
    ret = (ret + sum_depths(l + 1, r)) % 998244353;
  }
  if (s[r] != ')') {
    ret = (ret + sum_depths(l, r - 1)) % 998244353;
  }
  if (s[l] != '(' and s[r] != ')') {
    ret = (ret - sum_depths(l + 1, r - 1) + 998244353) % 998244353;
  }
  if (s[l] != ')' and s[r] != '(') {
    int k = acum[r - 1] - acum[l];
    ret = (ret + sum_depths(l + 1, r - 1) + mod_pow(2, k)) % 998244353;
  }
  return memo[l][r] = ret;
}
int main() {
  while (scanf("%s", s) > 0) {
    for (int i = 0; s[i]; i++) {
      acum[i] = (s[i] == '?');
      if (i) acum[i] += acum[i - 1];
    }
    memset(memo, -1, sizeof memo);
    printf("%lld\n", sum_depths(0, strlen(s) - 1));
  }
}
