#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2010;
const long long Mod = 998244353;
long long f[maxn][maxn], g[maxn][maxn], n;
char s[maxn];
inline long long power(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = r * a % Mod;
    a = a * a % Mod;
    b >>= 1;
  }
  return r;
}
signed main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (long long i = (1), _end_ = (n); i <= _end_; ++i)
    for (long long j = (i), _end_ = (n); j <= _end_; ++j)
      g[i][j] = g[i][j - 1] + (s[j] == '?');
  for (long long len = (2), _end_ = (n); len <= _end_; ++len)
    for (long long i = (1), _end_ = (n - len + 1); i <= _end_; ++i) {
      long long j = i + len - 1;
      if (s[i] != '(') f[i][j] += f[i + 1][j];
      if (s[j] != ')') f[i][j] += f[i][j - 1];
      if (s[i] != '(' && s[j] != ')') f[i][j] -= f[i + 1][j - 1];
      if (s[i] != ')' && s[j] != '(')
        f[i][j] += f[i + 1][j - 1] + power(2, g[i + 1][j - 1]);
      f[i][j] %= Mod;
    }
  printf("%lld\n", (f[1][n] + Mod) % Mod);
  return 0;
}
