#include <bits/stdc++.h>
using namespace std;
const int N = 2011, MOD = 998244353;
int F[N][N], G[N][N];
char s[N];
int n, Ans = 0;
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  F[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    if (s[i] == '(' || s[i] == '?') {
      for (int j = 1; j <= n; ++j) F[i][j] = (F[i][j] + F[i - 1][j - 1]) % MOD;
    }
    if (s[i] == ')' || s[i] == '?') {
      for (int j = 0; j <= n; ++j) F[i][j] = (F[i][j] + F[i - 1][j]) % MOD;
    }
  }
  G[n + 1][0] = 1;
  for (int i = n; i >= 1; --i) {
    if (s[i] == ')' || s[i] == '?') {
      for (int j = 1; j <= n; ++j) G[i][j] = (G[i][j] + G[i + 1][j - 1]) % MOD;
    }
    if (s[i] == '(' || s[i] == '?') {
      for (int j = 0; j <= n; ++j) G[i][j] = (G[i][j] + G[i + 1][j]) % MOD;
    }
  }
  for (int i = 2; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      Ans = (Ans + (long long)F[i - 1][j] * G[i][j] % MOD * j) % MOD;
  cout << Ans << endl;
  return 0;
}
