#include <bits/stdc++.h>
const int N = 2005, mod = 998244353;
using namespace std;
char ch[N];
int f[N][N], g[N][N], n;
int main() {
  scanf("%s", ch + 1);
  n = strlen(ch + 1);
  f[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = !(ch[i] != '('); j <= i; ++j) {
      if (ch[i] == '(')
        f[i][j] = f[i - 1][j - 1];
      else if (ch[i] == ')')
        f[i][j] = f[i - 1][j];
      else
        f[i][j] = (f[i - 1][j - 1] + f[i - 1][j]) % mod;
    }
  }
  g[n + 1][0] = 1;
  for (int i = n; i; --i) {
    for (int j = !(ch[i] != ')'); j <= n - i + 1; ++j)
      if (ch[i] == ')')
        g[i][j] = g[i + 1][j - 1];
      else if (ch[i] == '(')
        g[i][j] = g[i + 1][j];
      else
        g[i][j] = (g[i + 1][j - 1] + g[i + 1][j]) % mod;
  }
  long long ans = 0;
  for (int i = 1; i < n; ++i)
    for (int j = 1; j <= i; ++j) {
      ans += (1ll * ((1ll * f[i][j] * g[i + 1][j]) % mod) * j) % mod;
      if (ans >= mod) ans -= mod;
    }
  printf("%lld", ans);
  return 0;
}
