#include <bits/stdc++.h>
using namespace std;
const int M = 998244353;
const int N = 2003;
long long dp[N][N], fre[N];
long long power(long long b, long long p) {
  if (p == 0) return 1;
  if (p & 1) return (b * power((b * b) % M, p / 2)) % M;
  return (power((b * b) % M, p / 2)) % M;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    if (i) fre[i] += fre[i - 1];
    fre[i] += (s[i] == '?');
  }
  for (int len = 2; len <= n; len++) {
    for (int i = 0; i + len - 1 < n; i++) {
      int j = i + len - 1;
      if (s[i] != '(') dp[i][j] = (dp[i][j] + dp[i + 1][j]) % M;
      if (s[j] != ')') dp[i][j] = (dp[i][j] + dp[i][j - 1]) % M;
      if (s[i] != '(' && s[j] != ')')
        dp[i][j] = (dp[i][j] + M - dp[i + 1][j - 1]) % M;
      if (s[i] != ')' && s[j] != '(') {
        dp[i][j] = (dp[i][j] + dp[i + 1][j - 1]) % M;
        long long val = power(2, fre[j - 1] - fre[i]);
        dp[i][j] = (dp[i][j] + val) % M;
      }
    }
  }
  cout << dp[0][n - 1];
}
