#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long Sn;
char S[2020];
long long dp[2020][2020];
long long qn[2020], p2[2020];
long long i, j, k, ans;
int main() {
  scanf("%s", S);
  Sn = strlen(S);
  p2[0] = 1;
  for (i = 0; i < Sn; i++) {
    qn[i + 1] = qn[i] + (S[i] == '?');
    p2[i + 1] = p2[i] * 2 % (long long)998244353;
  }
  for (i = 1; i < Sn; i++) {
    if (S[i - 1] != ')' && S[i] != '(') {
      dp[i - 1][i] = 1;
    }
  }
  for (i = 2; i < Sn; i++) {
    for (j = i; j < Sn; j++) {
      long long l = j - i, r = j;
      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];
      if (S[l] != ')' && S[r] != '(')
        dp[l][r] += dp[l + 1][r - 1] + p2[qn[r] - qn[l + 1]];
      dp[l][r] %= (long long)998244353;
    }
  }
  printf("%lld", dp[0][Sn - 1]);
  return 0;
}
