#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
const int mod = 998244353;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
void inc(int &a, int b) { a = a + b >= mod ? a + b - mod : a + b; }
int add(int a, int b) { return a + b >= mod ? a + b - mod : a + b; }
int n, f[N][N], g[N][N], sf[N][N], sg[N][N];
char s[N];
void getsum(int f[N][N], int s[N][N]) {
  for (int i = 0; i <= n + 1; i++) {
    s[i][n + 1] = f[i][n + 1];
    for (int j = n; ~j; j--) s[i][j] = add(s[i][j + 1], f[i][j]);
  }
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  f[0][0] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j <= i; j++)
      if (s[i + 1] != '?')
        inc(f[i + 1][j + (s[i + 1] == '(')], f[i][j]);
      else
        inc(f[i + 1][j], f[i][j]), inc(f[i + 1][j + 1], f[i][j]);
  g[n + 1][0] = 1;
  for (int i = n + 1; i > 1; i--)
    for (int j = 0; j <= n - i + 1; j++)
      if (s[i - 1] != '?')
        inc(g[i - 1][j + (s[i - 1] == ')')], g[i][j]);
      else
        inc(g[i - 1][j], g[i][j]), inc(g[i - 1][j + 1], g[i][j]);
  getsum(f, sf);
  getsum(g, sg);
  int ans = 0;
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i < n; i++)
      if (s[i] != ')') {
        int ways = 1ll * f[i - 1][k - 1] * sg[i + 1][k] % mod;
        inc(ans, ways);
      }
  }
  cout << ans;
  return 0;
}
