#include <bits/stdc++.h>
using namespace std;
inline int rd() {
  int x = 0;
  char c = getchar();
  bool f = 0;
  while (c < '0' && c != '-') c = getchar();
  if (c == '-') f = 1, c = getchar();
  while (c >= '0') x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return f ? -x : x;
}
const int SIZE = 2005;
const int Mod = 998244353;
int n;
char a[SIZE];
int dp[SIZE][SIZE], pw[SIZE], sum[SIZE];
void _main() {
  scanf("%s", a + 1);
  n = strlen(a + 1);
  for (register int i = 1, _n = n; i <= _n; ++i)
    sum[i] = (sum[i - 1] + (a[i] == '?')) % Mod;
  pw[0] = 1;
  for (register int i = 1, _n = n; i <= _n; ++i) pw[i] = 2LL * pw[i - 1] % Mod;
  dp[1][n] = 1;
  int ans = 0;
  for (register int len = n, _n = 2; len >= _n; --len)
    for (register int l = 1, _n = n - len + 1; l <= _n; ++l) {
      int r = l + len - 1;
      if (a[l] != ')' && a[r] != '(') {
        ans = (ans + 1LL * dp[l][r] * pw[sum[r - 1] - sum[l]]) % Mod;
        dp[l + 1][r - 1] = (dp[l + 1][r - 1] + dp[l][r]) % Mod;
      }
      if (a[l] == ')')
        dp[l + 1][r] = (dp[l + 1][r] + dp[l][r]) % Mod;
      else if (a[r] == '(')
        dp[l][r - 1] = (dp[l][r - 1] + dp[l][r]) % Mod;
      else if (a[l] == '?') {
        dp[l + 1][r] = (dp[l + 1][r] + dp[l][r]) % Mod;
        if (a[r] == '?') {
          dp[l][r - 1] = (dp[l][r - 1] + dp[l][r]) % Mod;
          dp[l + 1][r - 1] = (dp[l + 1][r - 1] + Mod - dp[l][r]) % Mod;
        }
      } else if (a[r] == '?')
        dp[l][r - 1] = (dp[l][r - 1] + dp[l][r]) % Mod;
    }
  printf("%d\n", ans);
}
int main() {
  _main();
  return 0;
}
