#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
long long dp[2005][2005];
int f[2005];
long long qpow(long long a, long long n) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
int main() {
  char a[2005];
  scanf("%s", a);
  int l = strlen(a);
  for (int i = 0; i < l; i++) {
    f[i + 1] = f[i];
    f[i + 1] += a[i] == '?';
  }
  for (int len = 2; len <= l; len++) {
    for (int i = 0; i < l - len + 1; i++) {
      int j = i + len - 1;
      if (a[i] != '(') dp[i][j] = (dp[i][j] + dp[i + 1][j]) % mod;
      if (a[j] != ')') dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
      if (a[i] != '(' && a[j] != ')')
        dp[i][j] = (dp[i][j] - dp[i + 1][j - 1] + mod) % mod;
      if (a[i] != ')' && a[j] != '(')
        dp[i][j] =
            (dp[i][j] + dp[i + 1][j - 1] + qpow(2, f[j] - f[i + 1])) % mod;
    }
  }
  printf("%lld\n", dp[0][l - 1]);
}
