#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
long long f[2001], dp[2001][2001], m = 998244353;
long long fun(long long i, long long j) {
  if (i == 0)
    return (f[j]);
  else
    return (f[j] - f[i - 1]);
}
long long fpow(long long a, long long p) {
  if (p == 0) return (1);
  long long b = fpow(a, p / 2);
  if (p % 2 == 0)
    return ((b * b) % m);
  else
    return ((((b * b) % m) * a) % m);
}
int main() {
  string s;
  cin >> s;
  if (s[0] == '?') f[0] = 1;
  for (long long i = 1; i < s.length(); i++) {
    if (s[i] == '?') f[i] += 1;
    f[i] += f[i - 1];
  }
  for (long long i = 2; i <= s.length(); i++) {
    for (long long j = 0; j <= (s.length() - i); j++) {
      if (s[j] != '(')
        dp[j][j + i - 1] = (dp[j][j + i - 1] + dp[j + 1][j + i - 1]) % m;
      if (s[j + i - 1] != ')')
        dp[j][j + i - 1] = (dp[j][j + i - 1] + dp[j][j + i - 2]) % m;
      if ((s[j] != '(') && (s[j + i - 1] != ')'))
        dp[j][j + i - 1] = (dp[j][j + i - 1] - dp[j + 1][j + i - 2] + m) % m;
      if ((s[j] != ')') && (s[j + i - 1] != '('))
        dp[j][j + i - 1] = (dp[j][j + i - 1] + dp[j + 1][j + i - 2] +
                            (long long)fpow(2, fun(j + 1, j + i - 2))) %
                           m;
    }
  }
  cout << dp[0][s.length() - 1];
}
