#include <bits/stdc++.h>
using namespace std;
long long add(long long u, long long v) { return (u + v) % 998244353; }
long long mul(long long u, long long v) { return (u * v) % 998244353; }
const long long N = 2010;
string str;
long long f[N][N], dp[N][N];
long long n;
signed main() {
  cin >> str;
  n = str.length();
  f[0][0] = 1;
  for (long long i = 1; i <= n; ++i) {
    if (str[i - 1] != '(') f[i][0] = f[i - 1][0];
    for (long long k = 1; k <= n; ++k) {
      if (str[i - 1] == '(')
        f[i][k] = f[i - 1][k - 1];
      else {
        if (str[i - 1] == ')')
          f[i][k] = f[i - 1][k];
        else {
          f[i][k] = add(f[i - 1][k - 1], f[i - 1][k]);
        }
      }
    }
  }
  dp[n + 1][0] = 1;
  long long ans = 0;
  for (long long i = n; i >= 1; --i) {
    if (str[i - 1] != ')') dp[i][0] = dp[i + 1][0];
    for (long long k = 1; k <= n; ++k) {
      if (str[i - 1] == ')')
        dp[i][k] = dp[i + 1][k - 1];
      else {
        if (str[i - 1] == '(')
          dp[i][k] = dp[i + 1][k];
        else
          dp[i][k] = add(dp[i + 1][k - 1], dp[i + 1][k]);
      }
      ans = add(ans, mul(k, mul(dp[i][k], f[i - 1][k])));
    }
  }
  cout << ans << endl;
}
