#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool upmin(T &x, T y) {
  return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool upmax(T &x, T y) {
  return x < y ? x = y, 1 : 0;
}
const long double eps = 1e-11;
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long loo = 1ll << 62;
const int mods = 998244353;
const int MAXN = 2005;
const int INF = 0x3f3f3f3f;
inline int read() {
  int f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
char st[MAXN];
int pw[MAXN], s[MAXN], f[MAXN][MAXN];
signed main() {
  scanf("%s", st + 1);
  int n = strlen(st + 1);
  for (int i = 1; i <= n; i++) s[i] = s[i - 1] + (st[i] == '?');
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = (pw[i - 1] + pw[i - 1]) % mods;
  for (int l = 2; l <= n; l++)
    for (int i = 1; i <= n - l + 1; i++) {
      int j = i + l - 1, t = pw[s[j - 1] - s[i]];
      if (st[i] == '(' && st[j] == ')') f[i][j] = (f[i + 1][j - 1] + t) % mods;
      if (st[i] == '(' && st[j] == '(') f[i][j] = f[i][j - 1];
      if (st[i] == ')' && st[j] == ')') f[i][j] = f[i + 1][j];
      if (st[i] == ')' && st[j] == '(') f[i][j] = f[i + 1][j - 1];
      if (st[i] == ')' && st[j] == '?') f[i][j] = f[i + 1][j];
      if (st[i] == '(' && st[j] == '?')
        f[i][j] = ((f[i + 1][j - 1] + t) % mods + f[i][j - 1]) % mods;
      if (st[i] == '?' && st[j] == '(') f[i][j] = f[i][j - 1];
      if (st[i] == '?' && st[j] == ')')
        f[i][j] = ((f[i + 1][j - 1] + t) % mods + f[i + 1][j]) % mods;
      if (st[i] == '?' && st[j] == '?')
        f[i][j] = ((((f[i + 1][j - 1] + t) % mods + f[i + 1][j]) % mods +
                    f[i][j - 1]) %
                       mods +
                   mods - f[i + 1][j - 1]) %
                  mods;
    }
  printf("%d\n", f[1][n]);
  return 0;
}
