#include <bits/stdc++.h>
using namespace std;
const int p = 998244353;
template <typename T>
inline T read() {
  register T sum = 0;
  register char cc = getchar();
  int sym = 1;
  while (cc != '-' && (cc > '9' || cc < '0')) cc = getchar();
  if (cc == '-') sym = -1, cc = getchar();
  sum = sum * 10 + cc - '0';
  cc = getchar();
  while (cc >= '0' && cc <= '9') sum = sum * 10 + cc - '0', cc = getchar();
  return sym * sum;
}
template <typename T>
inline T read(T& a) {
  a = read<T>();
  return a;
}
template <typename T, typename... Others>
inline void read(T& a, Others&... b) {
  a = read(a);
  read(b...);
}
int n, s[2010], f[2010][2010];
char str[2010];
int add(int x, int y) { return (x + y) % p; }
int sub(int x, int y) { return (x - y + p) % p; }
int mul(int x, int y) { return 1ll * x * y % p; }
int fpow(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) res = mul(res, x);
    x = mul(x, x);
    y >>= 1;
  }
  return res;
}
int Get(int l, int r) {
  if (l > r) return 0;
  return s[r] - s[l - 1];
}
int main() {
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + (str[i] == '?');
  for (int len = 2; len <= n; len++)
    for (int l = 1; l + len - 1 <= n; l++) {
      int r = l + len - 1;
      if (str[l] != '(') f[l][r] = add(f[l][r], f[l + 1][r]);
      if (str[r] != ')') f[l][r] = add(f[l][r], f[l][r - 1]);
      if (str[l] != '(' && str[r] != ')')
        f[l][r] = sub(f[l][r], f[l + 1][r - 1]);
      if (str[l] != ')' && str[r] != '(')
        f[l][r] =
            add(f[l][r], add(f[l + 1][r - 1], fpow(2, Get(l + 1, r - 1))));
    }
  printf("%d\n", f[1][n]);
  return 0;
}
