#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c = getchar();
  int x = 0, f = 1;
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 2e3 + 5;
const long long Mod = 998244353;
long long fac[MAXN], ifac[MAXN];
char s[MAXN];
int sl[MAXN], sr[MAXN], sw[MAXN];
int N;
inline void Add(long long &x, long long y) { x = (x + y) % Mod; }
inline long long qpow(long long x, long long y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % Mod)
    if (y & 1) ret = ret * x % Mod;
  return ret;
}
inline long long C(int a, int b) {
  return fac[a] * ifac[b] % Mod * ifac[a - b] % Mod;
}
inline void init() {
  fac[0] = ifac[0] = 1;
  for (int i = 1; i <= N; i++) {
    fac[i] = fac[i - 1] * (long long)i % Mod;
    ifac[i] = qpow(fac[i], Mod - 2);
  }
}
int main() {
  scanf("%s", s + 1);
  N = strlen(s + 1);
  init();
  for (int i = 1; i <= N; i++) {
    sl[i] = sl[i - 1];
    sr[i] = sr[i - 1];
    sw[i] = sw[i - 1];
    if (s[i] == '(') sl[i]++;
    if (s[i] == ')') sr[i]++;
    if (s[i] == '?') sw[i]++;
  }
  long long ans = 0;
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= i; j++) {
      int totl = sl[i], totr = sr[N] - sr[i];
      if (j < totl || j < totr) continue;
      totl = j - totl;
      totr = j - totr;
      int nowl = sw[i], nowr = sw[N] - sw[i];
      if (nowl < totl || nowr < totr) continue;
      Add(ans, C(nowl, totl) * C(nowr, totr) % Mod * j % Mod);
    }
  printf("%I64d\n", ans);
  return 0;
}
