#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n;
char s[2010];
int num[2010], sum[2010];
int dp[2010][2010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int i, j;
  cin >> s + 1;
  n = strlen(s + 1);
  num[0] = 1;
  for (i = 1; i <= n; i++) {
    sum[i] = sum[i - 1] + (s[i] == '?');
    num[i] = (2LL * num[i - 1]) % mod;
  }
  for (i = 1; i <= n; i++)
    for (j = i - 1; j > 0; j--) {
      if (s[j] != '(') dp[j][i] = (dp[j][i] + dp[j + 1][i]) % mod;
      if (s[i] != ')') dp[j][i] = (dp[j][i] + dp[j][i - 1]) % mod;
      if (s[j] != '(' && s[i] != ')')
        dp[j][i] = (dp[j][i] - dp[j + 1][i - 1]) % mod;
      if (s[j] != ')' && s[i] != '(')
        dp[j][i] =
            ((dp[j][i] + dp[j + 1][i - 1]) % mod + num[sum[i - 1] - sum[j]]) %
            mod;
    }
  cout << (dp[1][n] + mod) % mod << endl;
  return 0;
}
