#include <bits/stdc++.h>
using namespace std;
string S;
long long int cnt[2020], dp[2020][2020];
long long int M = 998244353;
long long int fast(long long int a, long long int b) {
  long long int ret = 1, t = a;
  while (b) {
    if (b & 1) ret = (ret * t) % M;
    t = (t * t) % M;
    b >>= 1;
  }
  return ret;
}
long long int get(int l, int r) {
  long long int p = cnt[r] - (l == 0 ? 0 : cnt[l - 1]);
  return fast(2, p);
}
long long int solve(int l, int r) {
  if (l >= r) return 0;
  if (dp[l][r] != -1) return dp[l][r];
  dp[l][r] = 0;
  if (S[l] != ')' && S[r] != '(') {
    dp[l][r] += solve(l + 1, r - 1) + get(l + 1, r - 1);
  }
  if (S[l] != '(' && S[r] != ')') {
    dp[l][r] += solve(l + 1, r - 1);
  }
  int reduce = 0;
  if (S[l] != ')' && S[r] != ')') {
    dp[l][r] += solve(l, r - 1);
    if (S[l] == '?') reduce++;
  }
  if (S[l] != '(' && S[r] != '(') {
    dp[l][r] += solve(l + 1, r);
    if (S[r] == '?') reduce++;
  }
  dp[l][r] = dp[l][r] % M - (reduce * solve(l + 1, r - 1)) % M + M;
  dp[l][r] %= M;
  return dp[l][r];
}
int main() {
  while (cin >> S) {
    memset(dp, -1, sizeof(dp));
    memset(cnt, 0, sizeof(cnt));
    for (int i = 0; i < S.length(); ++i)
      cnt[i] = i == 0 ? (S[i] == '?') : (S[i] == '?') + cnt[i - 1];
    long long int ret = solve(0, S.length() - 1);
    cout << ret << endl;
  }
  return 0;
}
