#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e3 + 10;
const int mod = 998244353;
char s[maxn];
long long dp[maxn][maxn], sum[maxn];
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
int main(int argc, const char* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> (s + 1);
  int n = int(strlen(s + 1));
  for (int i = (1), _ = (int(strlen(s + 1))); i <= _; i++) {
    sum[i] = sum[i - 1] + (s[i] == '?');
  }
  for (int len = (2), _ = (n); len <= _; len++) {
    for (int l = 1, r = l + len - 1; r <= n; ++l, ++r) {
      if (s[l] != '(') dp[l][r] = (dp[l][r] + dp[l + 1][r]) % mod;
      if (s[r] != ')') dp[l][r] = (dp[l][r] + dp[l][r - 1]) % mod;
      if (s[l] != '(' && s[r] != ')')
        dp[l][r] = (dp[l][r] - dp[l + 1][r - 1] + mod) % mod;
      if (s[l] != ')' && s[r] != '(')
        dp[l][r] =
            (dp[l][r] + dp[l + 1][r - 1] + qpow(2, sum[r - 1] - sum[l])) % mod;
    }
  }
  cout << dp[1][n] << endl;
  return 0;
}
