#include <bits/stdc++.h>
using namespace std;
char v[2010];
long long sp[2010], p[2010], dp[2010][2010];
int n, i, j, lg;
long long get_value(int i, int j) {
  long long nr = sp[j] - sp[i - 1];
  return p[nr];
}
int main() {
  cin >> v + 1;
  n = strlen(v + 1);
  for (i = 1; i <= n; i++) {
    sp[i] = sp[i - 1];
    if (v[i] == '?') sp[i]++;
  }
  p[0] = 1;
  for (i = 1; i <= n; i++) p[i] = (1LL * 2 * p[i - 1]) % 998244353;
  for (i = 1; i < n; i++) {
    if (v[i] == '(') {
      if (v[i + 1] == ')' || v[i + 1] == '?')
        dp[i][i + 1] = 1;
      else
        dp[i][i + 1] = 0;
    } else {
      if (v[i] == ')')
        dp[i][i + 1] = 0;
      else {
        if (v[i + 1] == '?' || v[i + 1] == ')')
          dp[i][i + 1] = 1;
        else
          dp[i][i + 1] = 0;
      }
    }
  }
  for (lg = 2; lg < n; lg++) {
    for (i = 1; i + lg <= n; i++) {
      j = i + lg;
      if (v[i] == ')' || v[i] == '?')
        dp[i][j] = (dp[i][j] + dp[i + 1][j]) % 998244353;
      if (v[j] == '(' || v[j] == '?')
        dp[i][j] = (dp[i][j] + dp[i][j - 1]) % 998244353;
      if ((v[i] == ')' || v[i] == '?') && (v[j] == '(' || v[j] == '?')) {
        dp[i][j] = (dp[i][j] - dp[i + 1][j - 1]) % 998244353;
        if (dp[i][j] < 0) dp[i][j] += 998244353;
      }
      int ok = 1;
      if (v[i] == ')' || v[j] == '(') ok = 0;
      if (ok) {
        dp[i][j] = (dp[i][j] + dp[i + 1][j - 1]) % 998244353;
        dp[i][j] = (dp[i][j] + get_value(i + 1, j - 1)) % 998244353;
      }
    }
  }
  cout << dp[1][n];
  return 0;
}
