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