#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2010;
const long long mod = 998244353;
long long pw(long long a, long long b) {
  if (b == 0) return 1;
  long long k = pw(a, b / 2);
  k = (k * k) % mod;
  if (b & 1) k = (k * a) % mod;
  return k;
}
long long n, m;
long long dp[maxn][maxn], cnt[maxn], f[maxn][maxn];
string s;
signed main() {
  s += ".";
  string ss;
  cin >> ss;
  n = ss.size();
  s += ss;
  for (long long i = 1; i <= n; i++) cnt[i] = cnt[i - 1] + (s[i] == '?');
  for (long long t = 2; t <= n; t++)
    for (long long l = 1; l + t - 1 <= n; l++) {
      long long r = l + t - 1;
      if (t == 2) f[l][r] = (s[l] != ')');
      if (s[l] == ')') {
        dp[l][r] = dp[l + 1][r];
        f[l][r] = f[l + 1][r];
        continue;
      }
      if (s[r] == '(') {
        dp[l][r] = dp[l][r - 1];
        continue;
      }
      if (t == 2) {
        dp[l][r] = 1;
        continue;
      }
      long long K = pw(2, cnt[r - 1] - cnt[l]);
      f[l][r] = K + dp[l + 1][r - 1];
      if (s[l] == '?') f[l][r] += f[l + 1][r];
      f[l][r] %= mod;
      if (s[l] == '(' && s[r] == ')') dp[l][r] = (dp[l + 1][r - 1] + K) % mod;
      if (s[l] == '?' && s[r] == ')')
        dp[l][r] = (dp[l + 1][r] + dp[l + 1][r - 1] + K) % mod;
      if (s[l] == '(' && s[r] == '?')
        dp[l][r] = (dp[l][r - 1] + dp[l + 1][r - 1] + K) % mod;
      if (s[l] == '?' && s[r] == '?')
        dp[l][r] = (K + dp[l + 1][r - 1] + dp[l][r - 1] + f[l + 1][r]) % mod;
    }
  cout << dp[1][n];
}
