#include <bits/stdc++.h>
const int maxn = 2e3 + 10;
const int maxm = 1e5 + 10;
const long long int mod = 998244353;
const long long int INF = 1e18 + 100;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
const double eps = 1e-8;
using namespace std;
int n, m;
int cas, tol, T;
char ch[maxn];
long long int pow(long long int a, long long int b) {
  long long int ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return ans;
}
long long int dp[maxn][maxn], a[maxn];
int main() {
  scanf("%s", ch + 1);
  int len = strlen(ch + 1);
  a[0] = 0;
  for (int i = 1; i <= len; i++) {
    a[i] = a[i - 1] + (ch[i] == '?' ? 1 : 0);
    if (i != len && ch[i] != ')' && ch[i + 1] != '(') dp[i][i + 1] = 1;
  }
  for (int d = 3; d <= len; d++) {
    for (int i = 1; i + d - 1 <= len; i++) {
      int j = i + d - 1;
      dp[i][j] = 0;
      if (ch[i] != '(') dp[i][j] += dp[i + 1][j];
      if (ch[j] != ')') dp[i][j] += dp[i][j - 1];
      if (ch[i] != '(' && ch[j] != ')') dp[i][j] -= dp[i + 1][j - 1];
      if (ch[i] != ')' && ch[j] != '(')
        dp[i][j] += dp[i + 1][j - 1] + pow(2ll, a[j - 1] - a[i]);
      dp[i][j] %= mod;
    }
  }
  printf("%lld\n", dp[1][len]);
  return 0;
}
