#include <bits/stdc++.h>
using namespace std;
long long int MOD = 998244353;
long long int power(long long int x, long long int n, long long int &m) {
  x %= m;
  long long int ans = 1;
  while (n > 0) {
    if (n & 1) (ans *= x) %= m;
    (x = x * x) %= m;
    n >>= 1;
  }
  return ans;
}
const long long int mxn = 2000;
vector<vector<long long int>> dp(mxn + 1, vector<long long int>(mxn + 1, 0));
vector<long long int> prefix(mxn + 1, 0);
long long int len;
long long int getSum(vector<long long int> &prefix, long long int f,
                     long long int t) {
  if (f == 0) return prefix[t];
  return (prefix[t] - prefix[f - 1]);
}
void TESTCASE() {
  string s;
  cin >> s;
  len = s.size();
  prefix[0] = (s[0] == '?');
  for (long long int i = 1; i < len; i++)
    prefix[i] = prefix[i - 1] + (s[i] == '?');
  for (long long int l = 2; l <= len; l++) {
    for (long long int i = 0; i < len - l + 1; i++) {
      long long int j = i + l - 1;
      if (s[i] == ')' || s[i] == '?') {
        dp[i][j] += dp[i + 1][j];
        dp[i][j] %= MOD;
      }
      if (s[j] == '(' || s[j] == '?') {
        dp[i][j] += dp[i][j - 1];
        dp[i][j] %= MOD;
      }
      if ((s[i] == '?' && s[j] == '?') || (s[i] == ')' && s[j] == '(') ||
          (s[i] == '?' && s[j] == '(') || (s[i] == ')' && s[j] == '?')) {
        dp[i][j] -= dp[i + 1][j - 1];
        dp[i][j] += MOD;
        dp[i][j] %= MOD;
      }
      if ((s[i] == '?' && s[j] == '?') || (s[i] == '(' && s[j] == ')') ||
          (s[i] == '(' && s[j] == '?') || (s[i] == '?' && s[j] == ')')) {
        dp[i][j] +=
            dp[i + 1][j - 1] + power(2, getSum(prefix, i + 1, j - 1), MOD);
        dp[i][j] %= MOD;
      }
    }
  }
  cout << dp[0][len - 1] << "\n";
}
signed main() {
  long long int TESTS = 1;
  while (TESTS--) {
    TESTCASE();
  }
  return 0;
}
