#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize(3)
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize(3)
using namespace std;
const int mod = 998244353;
const int maxn = 2005;
struct ios {
  inline char gc() {
    static const int IN_LEN = 1 << 18 | 1;
    static char buf[IN_LEN], *s, *t;
    return (s == t) && (t = (s = buf) + fread(buf, 1, IN_LEN, stdin)),
           s == t ? -1 : *s++;
  }
  template <typename _Tp>
  inline ios &operator>>(_Tp &x) {
    static char ch, sgn;
    ch = gc(), sgn = 0;
    for (; !isdigit(ch); ch = gc()) {
      if (ch == -1) return *this;
      sgn |= ch == '-';
    }
    for (x = 0; isdigit(ch); ch = gc()) x = x * 10 + (ch ^ '0');
    sgn && (x = -x);
    return *this;
  }
} io;
int n, dp[maxn][maxn][3][3], qz[maxn], po[maxn], val[maxn];
char s[maxn];
void add(int &x, int y) {
  x += y;
  if (x >= mod) x -= mod;
}
int dfs(int l, int r) {
  if (l >= r) return 0;
  if (dp[l][r][val[s[l]]][val[s[r]]] != -1)
    return dp[l][r][val[s[l]]][val[s[r]]];
  int res = 0;
  int flag1 = (s[l] == '?');
  int flag2 = (s[r] == '?');
  for (int i = 0; i < 2; ++i) {
    if ((s[l] == ')' && (!i)) || (s[l] == '(' && i)) continue;
    for (int j = 0; j < 2; ++j) {
      if ((s[r] == ')' && (!j)) || (s[r] == '(' && j)) continue;
      if ((!i) && (j))
        add(res, (dfs(l + 1, r - 1) + po[qz[r - 1] - qz[l]]) % mod);
      else {
        s[l] = i + '(';
        s[r] = j + '(';
        if (i == 0 && j == 0) add(res, dfs(l, r - 1));
        if (i == 1 && j == 0) add(res, dfs(l + 1, r - 1));
        if (i == 1 && j == 1) add(res, dfs(l + 1, r));
        if (flag1) s[l] = '?';
        if (flag2) s[r] = '?';
      }
    }
  }
  dp[l][r][val[s[l]]][val[s[r]]] = res;
  return res;
}
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  po[0] = 1;
  for (int i = 1; i <= n; ++i) po[i] = 1LL * po[i - 1] * 2 % mod;
  memset(dp, -1, sizeof(dp));
  val['('] = 0;
  val[')'] = 1;
  val['?'] = 2;
  for (int i = 1; i <= n; ++i) {
    qz[i] = qz[i - 1];
    if (s[i] == '?') qz[i]++;
  }
  printf("%d\n", dfs(1, n));
}
