#include <bits/stdc++.h>
using namespace std;
const int N = 10000;
const long double pi = acos(-1.0);
int n, sum[2020];
long long bin[2020], f[2020][2020];
char s[2020];
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while ((ch < '0') || (ch > '9')) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ((ch >= '0') && (ch <= '9')) {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * f;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (register int i = 2; i <= n; i++) sum[i] = sum[i - 1] + (s[i] == '?');
  bin[0] = 1;
  for (register int i = 1; i <= n; i++) bin[i] = (bin[i - 1] * 2) % 998244353;
  for (register int len = 2; len <= n; len++) {
    for (int i = 1; i + len - 1 <= n; i++) {
      int j = i + len - 1;
      if (s[i] != '(') f[i][j] = (f[i][j] + f[i + 1][j]) % 998244353;
      if (s[j] != ')') f[i][j] = (f[i][j] + f[i][j - 1]) % 998244353;
      if ((s[i] != '(') && (s[j] != ')'))
        f[i][j] = (f[i][j] - f[i + 1][j - 1] + 998244353) % 998244353;
      if ((s[i] != ')') && (s[j] != '('))
        f[i][j] =
            (f[i][j] + f[i + 1][j - 1] + bin[sum[j - 1] - sum[i]]) % 998244353;
    }
  }
  printf("%lld", f[1][n]);
  return 0;
}
