#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int mod = 998244353;
long long dp[N][N];
char s[N];
int sum[N];
long long quick_pow(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return res;
}
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 = 1; len < n; len++) {
    for (int i = 1; i <= n; i++) {
      int j = i + len;
      if (j > n) break;
      long long &v = dp[i][j];
      if (s[i] != '(') v += dp[i + 1][j];
      if (s[j] != ')') v += dp[i][j - 1];
      if (s[i] != '(' && s[j] != ')') v = (v - dp[i + 1][j - 1] + mod) % mod;
      if (s[i] != ')' && s[j] != '(')
        v += dp[i + 1][j - 1] + quick_pow(2, sum[j - 1] - sum[i]);
      v %= mod;
    }
  }
  printf("%lld\n", dp[1][n]);
  return 0;
}
