#include <bits/stdc++.h>
using namespace std;
long long int expo(long long int a, long long int b) {
  if (b == 0) return 1;
  if (b % 2 == 0)
    return expo((a % 998244353 * a % 998244353) % 998244353, b / 2);
  return (expo(a, b - 1) % 998244353 * a % 998244353) % 998244353;
}
int main() {
  string s;
  cin >> s;
  long long int n = s.length();
  long long int fact[n + 1];
  long long int inv_fact[n + 1];
  fact[0] = 1;
  inv_fact[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] % 998244353 * (i) % 998244353) % 998244353;
    inv_fact[i] = expo(fact[i] % 998244353, 998244353 - 2) % 998244353;
  }
  long long int pre[n];
  long long int pre1[n];
  pre[0] = (s[0] == '?');
  pre1[0] = (s[0] == '(');
  for (long long int i = 1; i < n; i++) {
    pre[i] = pre[i - 1] + (s[i] == '?');
    pre1[i] = pre1[i - 1] + (s[i] == '(');
  }
  long long int post[n + 1];
  long long int post1[n + 1];
  post[n] = 0;
  post1[n] = 0;
  post1[n - 1] = (s[n - 1] == ')');
  post[n - 1] = (s[n - 1] == '?');
  for (long long int i = n - 2; i >= 0; i--) {
    post[i] = post[i + 1] + (s[i] == '?');
    post1[i] = post1[i + 1] + (s[i] == ')');
  }
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int c = 1; c <= n / 2; c++) {
      if (max(pre1[i], post1[i + 1]) > c) continue;
      if (pre[i] + pre1[i] < c) continue;
      if (post[i + 1] + post1[i + 1] < c) continue;
      long long int tmp = (fact[pre[i]] % 998244353 * inv_fact[c - pre1[i]] %
                           998244353 * inv_fact[pre[i] - c + pre1[i]]) %
                          998244353;
      tmp = (tmp % 998244353 * fact[post[i + 1]] % 998244353 *
             inv_fact[c - post1[i + 1]] % 998244353 *
             inv_fact[post[i + 1] - c + post1[i + 1]] % 998244353) %
            998244353;
      tmp = (tmp % 998244353 * c % 998244353) % 998244353;
      ans = (ans % 998244353 + tmp % 998244353) % 998244353;
    }
  }
  cout << ans;
}
