#include <bits/stdc++.h>
using namespace std;
char buf[1 << 21], *p1 = buf, *p2 = buf;
long long read() {
  long long w = 0, f = 1;
  char c = ' ';
  while (c < '0' || c > '9')
    c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++),
    f = c == '-' ? -1 : f;
  while (c >= '0' && c <= '9')
    w = w * 10 + c - 48,
    c = (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2)
             ? EOF
             : *p1++);
  return w * f;
}
long long n, a[2005], w[2005], dp[2005][2005], p[2005] = {1};
const long long mod = 998244353;
char s[2005];
void init() {
  for (long long i = 1; i < 2005; i++) p[i] = (p[i - 1] << 1) % mod;
}
signed main() {
  init();
  scanf("%s", s);
  n = strlen(s);
  for (long long i = 1; i <= n; i++)
    a[i] = (s[i - 1] == '?') ? 0 : (s[i - 1] == '(' ? 1 : -1),
    w[i] = w[i - 1] + (!a[i]);
  long long x;
  for (long long i = 2; i <= n; i++)
    for (long long j = 1; j <= n - i + 1; j++) {
      x = i + j - 1;
      if (a[x] != -1) dp[j][x] = (dp[j][x] + dp[j][x - 1]) % mod;
      if (a[j] != 1)
        dp[j][x] = (dp[j][x] + dp[j + 1][x] -
                    (a[x] == -1 ? 0 : dp[j + 1][x - 1]) + mod) %
                   mod;
      if (a[j] != -1)
        dp[j][x] = (dp[j][x] +
                    (a[x] == 1 ? 0 : p[w[x - 1] - w[j]] + dp[j + 1][x - 1])) %
                   mod;
    }
  printf("%lld", dp[1][n]);
  return 0;
}
