#include <bits/stdc++.h>
using namespace std;
int n, dp[2039][2039], sum[2039];
char ch[2039];
long long quick_mod(long long i, int j) {
  long long res = 1;
  while (j) {
    if (j & 1) (res *= i) %= 998244353;
    (i *= i) %= 998244353, j >>= 1;
  }
  return res;
}
int main() {
  scanf(" %s", ch + 1);
  n = strlen(ch + 1);
  for (int a = 1; a <= n; a++) {
    sum[a] = sum[a - 1] + (ch[a] == '?');
  }
  for (int a = 1; a < n; a++) {
    for (int b = 1; b + a <= n; b++) {
      if (ch[b] != '(') (dp[b][b + a] += dp[b + 1][b + a]) %= 998244353;
      if (ch[b + a] != ')') (dp[b][b + a] += dp[b][b + a - 1]) %= 998244353;
      if (ch[b] != '(' && ch[b + a] != ')') {
        (dp[b][b + a] -= dp[b + 1][b + a - 1] - 998244353) %= 998244353;
      }
      if (ch[b] != ')' && ch[b + a] != '(') {
        (dp[b][b + a] += dp[b + 1][b + a - 1]) %= 998244353;
        (dp[b][b + a] += quick_mod(2, sum[b + a - 1] - sum[b])) %= 998244353;
      }
    }
  }
  printf("%d", dp[1][n]);
  return 0;
}
