#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 3;
const int mod = 998244353;
int n;
string s;
long long dp[N][N];
long long cnt[N][N];
long long mu[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  s = ' ' + s;
  dp[0][0] = 1;
  for (int i = n; i >= 1; i--) {
    for (int j = i; j <= n; j++) {
      if (s[j] == '?')
        cnt[i][j] = cnt[i][j - 1] + 1;
      else
        cnt[i][j] = cnt[i][j - 1];
    }
    dp[i][i] = 0;
  }
  mu[0] = 1;
  for (int i = 1; i <= n; i++) mu[i] = mu[i - 1] * 2, mu[i] %= mod;
  for (int i = n - 1; i >= 1; i--) {
    for (int j = i + 1; j <= n; j++) {
      if (s[i] != '(') {
        dp[i][j] += dp[i + 1][j];
        if (dp[i][j] > mod) dp[i][j] -= mod;
      }
      if (s[j] != ')') {
        dp[i][j] += dp[i][j - 1];
        if (dp[i][j] > mod) dp[i][j] -= mod;
      }
      if (s[i] != '(' && s[j] != ')') {
        dp[i][j] -= dp[i + 1][j - 1];
        if (dp[i][j] < 0) dp[i][j] += mod;
      }
      if (s[i] != ')' && s[j] != '(') {
        dp[i][j] += (dp[i + 1][j - 1] + mu[cnt[i + 1][j - 1]]) % mod;
        if (dp[i][j] > mod) dp[i][j] -= mod;
      }
    }
  }
  cout << dp[1][n];
}
