#include <bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;
int n, A[2001];
long long F[2001][2001][2][2], res = 0, rev2;
string s;
void add(long long &x, long long y) { x = (x + y) % MOD; }
long long cal(long long x, long long y) {
  if (y == 0) return 1;
  if (y == 1) return x % MOD;
  long long t = cal(x, y / 2);
  t = (t * t) % MOD;
  return y % 2 == 0 ? t : (t * x) % MOD;
}
void update(int l, int r, int i, int j) {
  if (i == 1) {
    if (A[l + 1] >= 0)
      add(F[l + 1][r][A[l + 1]][j], F[l][r][i][j]);
    else {
      add(F[l + 1][r][0][j], (F[l][r][i][j] * rev2) % MOD);
      add(F[l + 1][r][1][j], (F[l][r][i][j] * rev2) % MOD);
    }
  } else if (j == 0) {
    if (A[r - 1] >= 0)
      add(F[l][r - 1][i][A[r - 1]], F[l][r][i][j]);
    else {
      add(F[l][r - 1][i][0], (F[l][r][i][j] * rev2) % MOD);
      add(F[l][r - 1][i][1], (F[l][r][i][j] * rev2) % MOD);
    }
  } else {
    add(res, F[l][r][i][j]);
    if (l + 1 >= r) return;
    long long z =
        ((A[l + 1] == -1 ? rev2 : 1) * (A[r - 1] == -1 ? rev2 : 1)) % MOD;
    for (int x = 0; x <= 1; ++x)
      if (A[l + 1] == x || A[l + 1] == -1)
        for (int y = 0; y <= 1; ++y)
          if (A[r - 1] == y || A[r - 1] == -1) {
            add(F[l + 1][r - 1][x][y], (F[l][r][i][j] * z) % MOD);
          }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cin >> s;
  n = s.size();
  rev2 = cal(2, MOD - 2);
  long long total = 1;
  for (int i = 1; i <= n; ++i) {
    if (s[i - 1] == '?') {
      A[i] = -1;
      total = (total * 2) % MOD;
    } else if (s[i - 1] == '(')
      A[i] = 0;
    else
      A[i] = 1;
  }
  long long t = ((A[1] == -1 ? rev2 : 1) * (A[n] == -1 ? rev2 : 1)) % MOD;
  for (int i = 0; i <= 1; ++i)
    if (A[1] == i || A[1] == -1)
      for (int j = 0; j <= 1; ++j)
        if (A[n] == j || A[n] == -1) {
          F[1][n][i][j] = (total * t) % MOD;
        }
  for (int l = 1; l <= n; ++l)
    for (int r = n; r > l; --r)
      for (int i = 0; i <= 1; ++i)
        for (int j = 0; j <= 1; ++j) update(l, r, i, j);
  cout << res;
  return 0;
}
