#include <bits/stdc++.h>
using namespace std;
const int maxn = 2050;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
long long fpow(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long dp[maxn][maxn], a[maxn];
char s[maxn];
int main() {
  int i, j, k, m, n;
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (i = 1; i <= n; i++) a[i] = a[i - 1] + (s[i] == '?');
  for (k = 2; k <= n; k++)
    for (i = 1; i + k - 1 <= n; i++) {
      j = i + k - 1;
      dp[i][j] = (dp[i][j] + (s[i] != '(' ? dp[i + 1][j] : 0)) % mod;
      dp[i][j] = (dp[i][j] + (s[j] != ')' ? dp[i][j - 1] : 0)) % mod;
      dp[i][j] = (dp[i][j] + mod -
                  (s[i] != '(' && s[j] != ')' ? dp[i + 1][j - 1] : 0)) %
                 mod;
      dp[i][j] =
          (dp[i][j] + (s[i] != ')' && s[j] != '('
                           ? (dp[i + 1][j - 1] + fpow(2, a[j - 1] - a[i])) % mod
                           : 0)) %
          mod;
    }
  cout << dp[1][n] << endl;
  return 0;
}
