#include <bits/stdc++.h>
using namespace std;
constexpr int N = 2223;
constexpr int P = 998244353;
inline long long qpow(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1, a = a * a % P)
    if (b & 1) ans = ans * a % P;
  return ans;
}
int n, dp[N][N], a[N];
char s[N];
int main() {
  cin >> s + 1;
  n = strlen(s + 1);
  for (int i = (1); i <= (n); ++i) a[i] = a[i - 1] + (s[i] == '?');
  for (int L = (2); L <= (n); ++L)
    for (int l = (1); l <= (n - L + 1); ++l) {
      int r = l + L - 1;
      int &v = dp[l][r];
      if (s[l] == '(' && s[r] == '(') v += dp[l][r - 1];
      if (s[l] == '(' && s[r] == ')')
        v += (dp[l + 1][r - 1] + qpow(2, a[r - 1] - a[l])) % P;
      if (s[l] == '(' && s[r] == '?')
        v += dp[l][r - 1], v %= P,
            v += (dp[l + 1][r - 1] + qpow(2, a[r - 1] - a[l])) % P;
      if (s[l] == ')' && s[r] == '(') v += dp[l + 1][r - 1];
      if (s[l] == ')' && s[r] == ')') v += dp[l + 1][r];
      if (s[l] == ')' && s[r] == '?') v += dp[l + 1][r];
      if (s[l] == '?' && s[r] == '(') v += dp[l][r - 1];
      if (s[l] == '?' && s[r] == ')')
        v += dp[l + 1][r], v %= P,
            v += (dp[l + 1][r - 1] + qpow(2, a[r - 1] - a[l])) % P;
      if (s[l] == '?' && s[r] == '?')
        v += (dp[l][r - 1] - dp[l + 1][r - 1] + P) % P, v %= P,
            v += (dp[l + 1][r] - dp[l + 1][r - 1] + P) % P, v %= P,
            v += dp[l + 1][r - 1], v %= P,
            v += (dp[l + 1][r - 1] + qpow(2, a[r - 1] - a[l])) % P;
      v %= P;
    }
  cout << (dp[1][n] % P + P) % P << '\n';
}
