#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int maxn = 2e3 + 100;
string s;
long long dp[maxn][maxn] = {0};
int num[maxn] = {0};
long long qmod(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  int len = s.length();
  for (int i = 1; i <= len; ++i) {
    num[i] = num[i - 1];
    if (s[i - 1] == '?') {
      ++num[i];
    }
  }
  for (int i = 1; i <= len; ++i) {
    for (int j = 0; j + i < len; ++j) {
      int l = j, r = i + j;
      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] + qmod(2, num[r] - num[l + 1])) % mod;
      }
    }
  }
  cout << dp[0][len - 1] << endl;
  return 0;
}
