#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int dp[2005][2005], dp2[2005][2005];
inline void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  if (s[0] == '(' || s[0] == '?') dp[0][1] = 1;
  if (s[0] == ')' || s[0] == '?') dp[0][0] = 1;
  for (int i = 0; i + 1 < n; ++i)
    for (int d = 0; d <= i + 1; ++d) {
      if (s[i + 1] == '(' || s[i + 1] == '?') add(dp[i + 1][d + 1], dp[i][d]);
      if (s[i + 1] == ')' || s[i + 1] == '?') add(dp[i + 1][d], dp[i][d]);
    }
  if (s.back() == '(' || s.back() == '?') dp2[n - 1][0] = 1;
  if (s.back() == ')' || s.back() == '?') dp2[n - 1][1] = 1;
  for (int i = n - 1; i - 1 >= 0; --i)
    for (int d = 0; d <= n - i; ++d) {
      if (s[i - 1] == '(' || s[i - 1] == '?') add(dp2[i - 1][d], dp2[i][d]);
      if (s[i - 1] == ')' || s[i - 1] == '?') add(dp2[i - 1][d + 1], dp2[i][d]);
    }
  int ans = 0;
  for (int i = 0; i + 1 < n; ++i)
    for (int d = 1; d <= n; ++d)
      add(ans, (long long)dp[i][d] * dp2[i + 1][d] % mod * d % mod);
  cout << ans << "\n";
  return 0;
}
