#include <bits/stdc++.h>
using namespace std;
const int N = 2010;
const int Mod = 998244353;
long long Min(long long x, long long y) { return x < y ? x : y; }
long long Max(long long x, long long y) { return x > y ? x : y; }
long long R() {
  long long ans = 0, f = 1;
  char c = ' ';
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) ans = ans * 10 + c - '0';
  return ans * f;
}
char s[N];
long long dp[N][N], mi[N];
int a[N], n;
int main() {
  cin >> (s + 1);
  n = strlen(s + 1);
  for (int i = 1; i <= n; ++i) a[i] = a[i - 1] + (s[i] == '?');
  mi[0] = 1;
  for (int i = 1; i <= n; ++i) mi[i] = mi[i - 1] * 2 % Mod;
  for (int ll = 1; ll <= n; ++ll)
    for (int l = 1; l <= n; ++l) {
      int r = l + ll;
      if (r > n) break;
      if (s[l] != '(') dp[l][r] += dp[l + 1][r];
      if (s[r] != ')') dp[l][r] += dp[l][r - 1];
      if (s[l] != ')' && s[r] != '(')
        dp[l][r] += dp[l + 1][r - 1] + mi[a[r - 1] - a[l]];
      if (s[l] != '(' && s[r] != ')') dp[l][r] -= dp[l + 1][r - 1];
      dp[l][r] = (dp[l][r] + Mod) % Mod;
    }
  cout << dp[1][n];
  return 0;
}
