#include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
long long **num_of_substrs;
long long **dp;
void compute_substrs(string s, int n) {
  for (int i = 0; i < n; i++) {
    long long ans = 1;
    for (int j = i; j < n; j++) {
      if (s[j] == '?') ans = (ans * 2) % mod;
      num_of_substrs[i][j] = ans;
    }
  }
}
long long dp_func(int i, int j, string &s) {
  if (i == j) return 0;
  if (i + 1 == j) {
    if (s[i] == ')' || s[j] == '(') return 0;
    return 1;
  }
  if (dp[i][j] != -1) return dp[i][j];
  if (s[i] == ')') return dp[i][j] = dp_func(i + 1, j, s);
  if (s[j] == '(') return dp[i][j] = dp_func(i, j - 1, s);
  if (s[i] == '(' && s[j] == ')') {
    return dp[i][j] =
               (dp_func(i + 1, j - 1, s) + num_of_substrs[i + 1][j - 1]) % mod;
  }
  if (s[i] == '(' && s[j] == '?') {
    return dp[i][j] = (dp_func(i + 1, j - 1, s) + num_of_substrs[i + 1][j - 1] +
                       dp_func(i, j - 1, s)) %
                      mod;
  }
  if (s[i] == '?' && s[j] == ')') {
    return dp[i][j] = (dp_func(i + 1, j - 1, s) + num_of_substrs[i + 1][j - 1] +
                       dp_func(i + 1, j, s)) %
                      mod;
  }
  return dp[i][j] = (dp_func(i + 1, j, s) + dp_func(i, j - 1, s) +
                     num_of_substrs[i + 1][j - 1]) %
                    mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  string s;
  cin >> s;
  int n = s.length();
  num_of_substrs = new long long *[n];
  dp = new long long *[n];
  for (int i = 0; i < n; i++) {
    num_of_substrs[i] = new long long[n];
    dp[i] = new long long[n];
    for (int j = 0; j < n; j++) dp[i][j] = -1;
  }
  compute_substrs(s, n);
  cout << dp_func(0, n - 1, s);
}
