#include <bits/stdc++.h>
using namespace std;
const int N = 2005, MOD = 998244353;
int dp[2][N][N][2], sum[N][N];
void add(int &a, int b) {
  a += b;
  if (a >= MOD) a -= MOD;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  string s;
  cin >> s;
  int n = s.size();
  for (int g = 0; g < 2; g++) {
    dp[g][0][0][0] = 1;
    for (int i = 0; i < n; i++) {
      int l = 0, r = 1;
      if (s[i] == '(')
        l = 1;
      else if (s[i] == ')')
        r = 0;
      for (int k = 0; k <= i; k++) {
        for (int last = 0; last < 2; last++) {
          if (dp[g][i][k][last] != 0) {
            for (int j = l; j <= r; j++) {
              add(dp[g][i + 1][k + j][j], dp[g][i][k][last]);
            }
          }
        }
      }
    }
    reverse(s.begin(), s.end());
    for (char &c : s) {
      if (c != '?') c = (c == '(' ? ')' : '(');
    }
  }
  for (int i = 1; i < n; i++) {
    for (int j = n; j > 0; j--) {
      sum[i][j] = (dp[1][i][j][0] + dp[1][i][j][1]) % MOD;
      add(sum[i][j], sum[i][j + 1]);
    }
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= n; j++) {
      ans = (ans + dp[0][i][j][1] * (long long)sum[n - i][j] % MOD) % MOD;
    }
  }
  cout << ans;
  return 0;
}
