#include <bits/stdc++.h>
using namespace std;
const int maxn = 2005;
const long long mod = 998244353;
string s, t;
long long p[maxn], n;
long long dp[maxn][maxn];
long long ksm(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = (r * a) % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return r;
}
long long dfs(int l, int r) {
  if (dp[l][r] != -1) return dp[l][r];
  if (l >= r || l > n || r <= 0) return dp[l][r] = 0;
  long long ans = 0;
  if (s[l] != '(') ans = (ans + dfs(l + 1, r)) % mod;
  if (s[r] != ')') ans = (ans + dfs(l, r - 1)) % mod;
  if (s[l] != '(' && s[r] != ')') ans = (ans - dfs(l + 1, r - 1) + mod) % mod;
  if (s[l] != ')' && s[r] != '(')
    ans = (ans + dfs(l + 1, r - 1) + ksm(2, p[r - 1] - p[l])) % mod;
  return dp[l][r] = ans;
}
int main() {
  s += '#';
  cin >> t;
  s += t;
  n = t.size();
  memset(dp, -1, sizeof(dp));
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] + (s[i] == '?');
  dfs(1, n);
  cout << dp[1][n] << endl;
}
