#include <bits/stdc++.h>
using namespace std;
const long MOD = 998244353;
string s;
long n, cnt[2005], f[2005][2005];
long long power(long long x, long long n) {
  if (n == 0) return 1;
  if (n == 1) return x;
  long long t = power(x, n >> 1);
  t = (t * t) % MOD;
  if (n & 1) t = (t * x) % MOD;
  return t;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  s = ' ' + s;
  for (long i = 1; i <= n; i++) {
    cnt[i] = cnt[i - 1] + (s[i] == '?');
  }
  for (long kc = 1; kc < n; kc++) {
    for (long i = 1; i <= n - kc; i++) {
      long j = i + kc;
      if (s[i] != '(') {
        f[i][j] = (f[i][j] + f[i + 1][j]) % MOD;
      }
      if (s[j] != ')') {
        f[i][j] = (f[i][j] + f[i][j - 1]) % MOD;
      }
      if (s[i] != '(' && s[j] != ')') {
        f[i][j] = (f[i][j] - f[i + 1][j - 1] + MOD) % MOD;
      }
      if (s[i] != ')' && s[j] != '(') {
        f[i][j] = (f[i][j] + f[i + 1][j - 1]) % MOD;
        f[i][j] = (f[i][j] + power(2, cnt[j - 1] - cnt[i])) % MOD;
      }
    }
  }
  cout << f[1][n];
  return 0;
}
