#include <bits/stdc++.h>
const int maxn = 2e3 + 10;
const int maxm = 1e5 + 10;
const long long int mod = 998244353;
const long long int INF = 1e18 + 100;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-8;
using namespace std;
int n, m, TT;
int cas, tol;
int a[maxn] = {0};
char s[maxn];
long long int dp[maxn][maxn];
long long int fpow(long long int a, long long int b) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++) {
    a[i] = a[i - 1] + (s[i] == '?');
    dp[i][i] = 0;
    dp[i][i + 1] = (i + 1 <= n && s[i] != ')' && s[i + 1] != '(');
  }
  for (int d = 3; d <= n; d++) {
    for (int i = 1, j = d, c; j <= n; i++, j++) {
      dp[i][j] = 0, c = -1;
      if (s[i] != ')') {
        if (s[j] != ')') dp[i][j] += dp[i][j - 1], c++;
        if (s[j] != '(')
          dp[i][j] += dp[i + 1][j - 1] + fpow(2, a[j - 1] - a[i]);
      }
      if (s[i] != '(') {
        if (s[j] != ')') dp[i][j] += dp[i + 1][j - 1], c++;
        if (s[j] != '(') dp[i][j] += dp[i + 1][j], c++;
      }
      dp[i][j] -= max(c, 0) * dp[i + 1][j - 1];
      dp[i][j] %= mod;
    }
  }
  printf("%lld\n", dp[1][n]);
  return 0;
}
