#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 1;
const long long MOD = 998244353;
const long long MAXN = 1e6 + 5;
const long double EPS = 1e-12;
const long double PI = acos(-1);
const long long XX[] = {0, -1, 0, 1, 0, -1};
const long long YY[] = {-1, 0, 1, 0, -1, 0};
const long long ALPH = 31;
const long long LEN = 20;
mt19937 gen(228);
void bye() {
  cout << "\n";
  exit(0);
}
long long binPow(long long a, long long b) {
  if (!b) {
    return 1;
  }
  if (b == 1) {
    return a % MOD;
  }
  long long z = binPow(a, b / 2);
  if (b & 1) {
    return (((a * z) % MOD) * z) % MOD;
  }
  return (z * z) % MOD;
}
void solve() {
  string s;
  cin >> s;
  vector<vector<long long> > dp((long long)(s).size(),
                                vector<long long>((long long)(s).size()));
  vector<long long> pref((long long)(s).size());
  pref[0] = (s[0] == '?');
  for (long long i = 1; i < (long long)(s).size(); i++) {
    pref[i] = pref[i - 1] + (s[i] == '?');
  }
  for (long long len = 1; len < (long long)(s).size(); len++) {
    for (long long l = 0; l + len < (long long)(s).size(); l++) {
      long long r = l + len;
      if (s[l] != '(') {
        dp[l][r] += dp[l + 1][r];
        dp[l][r] %= MOD;
      }
      if (s[r] != ')') {
        dp[l][r] += dp[l][r - 1];
        dp[l][r] %= MOD;
      }
      if (s[l] != '(' && s[r] != ')') {
        dp[l][r] -= dp[l + 1][r - 1];
        dp[l][r] += MOD;
        dp[l][r] %= MOD;
      }
      if (s[l] != ')' && s[r] != '(') {
        dp[l][r] += (dp[l + 1][r - 1] + binPow(2, pref[r - 1] - pref[l])) % MOD;
        dp[l][r] %= MOD;
      }
    }
  }
  cout << dp[0][(long long)(s).size() - 1];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long TEST_COUNT = 1;
  while (TEST_COUNT--) {
    solve();
  }
}
