#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e3 + 10;
const int mod = 998244353;
char s[MAXN];
int n, bk[MAXN];
long long f[MAXN][MAXN];
long long qpow(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * x % mod;
    k >>= 1;
    x = x * x % mod;
  }
  return res;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) bk[i] = bk[i - 1] + (s[i] == '?');
  for (int len = 2; len <= n; len++)
    for (int l = 1, r = l + len - 1; r <= n; l++, r++) {
      if (s[l] != '(') f[l][r] = (f[l][r] + f[l + 1][r]) % mod;
      if (s[r] != ')') f[l][r] = (f[l][r] + f[l][r - 1]) % mod;
      if (s[l] != '(' && s[r] != ')')
        f[l][r] = (f[l][r] - f[l + 1][r - 1] + mod) % mod;
      if (s[l] != ')' && s[r] != '(')
        f[l][r] =
            (f[l][r] + f[l + 1][r - 1] + qpow(2, bk[r - 1] - bk[l])) % mod;
    }
  printf("%lld\n", f[1][n]);
  return 0;
}
