#include <bits/stdc++.h>
using namespace std;
void boost() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const int N = 1e6;
const long long inf = 998244353;
const long double PI = acos(-1);
long long bin_pow(long long x, long long y) {
  long long res = 1, base = x;
  while (y) {
    if (y & 1) {
      res *= base;
      res %= inf;
    }
    base *= base;
    base %= inf;
    y /= 2;
  }
  return res;
}
string s;
int pref[2005];
long long dp[2005][2005];
int main() {
  boost();
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    pref[i + 1] = pref[i] + (s[i] == '?');
  }
  for (int len = 2; len <= s.size(); len++) {
    for (int i = 0; i + len - 1 < s.size(); i++) {
      int j = i + len - 1;
      if (s[i] != '(') {
        dp[i][j] += dp[i + 1][j];
        dp[i][j] %= inf;
      }
      if (s[j] != ')') {
        dp[i][j] += dp[i][j - 1];
        dp[i][j] %= inf;
      }
      if (s[i] != '(' && s[j] != ')') {
        dp[i][j] -= dp[i + 1][j - 1];
        dp[i][j] += inf;
        dp[i][j] %= inf;
      }
      if (s[i] != ')' && s[j] != '(') {
        dp[i][j] += dp[i + 1][j - 1];
        dp[i][j] += bin_pow(2, pref[j] - pref[i + 1]);
        dp[i][j] %= inf;
      }
    }
  }
  cout << dp[0][s.size() - 1];
}
