#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)2110;
const int mod = (int)998244353;
int n, c[maxn][maxn], pref[3][maxn], ans;
string second, cur;
int C(int n, int k) {
  if (n < 0 || k < 0 || n < k) return 0;
  return c[n][k];
}
int main() {
  cin >> second;
  n = ((int)(second).size());
  c[0][0] = 1;
  for (int i = (1); i <= (maxn - 1); ++i) {
    c[i][0] = c[i][i] = 1;
    for (int j = (1); j <= (maxn - 1); ++j)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
  }
  for (int i = (1); i <= (n); ++i) {
    pref[0][i] = pref[0][i - 1] + (second[i - 1] == '(');
    pref[1][i] = pref[1][i - 1] + (second[i - 1] == ')');
    pref[2][i] = pref[2][i - 1] + (second[i - 1] == '?');
  }
  for (int i = (1); i <= (n - 1); ++i) {
    for (int j = (1); j <= (n); ++j) {
      int way1 = C(pref[2][i], j - pref[0][i]);
      int way2 = C(pref[2][n] - pref[2][i], j - (pref[1][n] - pref[1][i]));
      ans = (ans + (way1 * 1ll * way2) % mod * 1ll * j % mod) % mod;
    }
  }
  cout << ans;
}
