#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
const int mod = 998244353;
long long dp[N][N];
int sum[N];
char s[N];
int js(int l, int r) { return sum[r] - sum[l - 1]; }
long long p[N];
int main() {
  p[0] = 1;
  for (int i = 1; i < N; i++) p[i] = (p[i - 1] * 2) % mod;
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= n; i++) {
    if (s[i] == '?')
      sum[i] = sum[i - 1] + 1;
    else
      sum[i] = sum[i - 1];
  }
  for (int i = 1; i <= n; i++) dp[i][i] = 0;
  for (int len = 2; len <= n; len++) {
    for (int l = 1; l <= n + 1 - len; l++) {
      int r = len + l - 1;
      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] + p[js(l + 1, r - 1)]) % mod;
    }
  }
  printf("%lld\n", dp[1][n]);
  return 0;
}
