#include <bits/stdc++.h>
const int maxn = 2e3 + 7;
const long long mod = 998244353;
using namespace std;
char s[maxn];
long long dp[maxn][maxn];
long long sum[maxn];
long long qpow(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans *= x, ans %= mod;
    y >>= 1;
    x *= x;
    x %= mod;
  }
  return (ans + mod) % mod;
}
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) sum[i] = sum[i - 1] + (s[i] == '?');
  for (int len = 2; len <= n; ++len) {
    for (int i = 1, j = i + len - 1; j <= n; ++i, ++j) {
      if (s[i] != '(') dp[i][j] = (dp[i][j] + dp[i + 1][j]) % mod;
      if (s[j] != ')') dp[i][j] = (dp[i][j] + dp[i][j - 1]) % mod;
      if (s[i] != '(' && s[j] != ')')
        dp[i][j] = (dp[i][j] - dp[i + 1][j - 1] + mod) % mod;
      if (s[i] != ')' && s[j] != '(')
        dp[i][j] =
            (dp[i][j] + dp[i + 1][j - 1] + qpow(2ll, sum[j - 1] - sum[i])) %
            mod;
    }
  }
  printf("%lld\n", dp[1][n]);
}
