#include <bits/stdc++.h>
using namespace std;
const long long BIG = 1000000000000000000LL;
void solve();
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
const long long m998 = 998244353;
template <long long MOD>
struct ModInt {
  long long x;
  ModInt() : x(0) {}
  ModInt(long long u) : x(u) {
    if (x >= MOD || x < 0) {
      x %= MOD;
      if (x < 0) x += MOD;
    }
  }
  ModInt(const ModInt& m) : x(m.x) {}
  ModInt& operator=(const ModInt& m) {
    x = m.x;
    return *this;
  }
  friend bool operator==(const ModInt& a, const ModInt& b) {
    return a.x == b.x;
  }
  friend bool operator!=(const ModInt& a, const ModInt& b) {
    return a.x != b.x;
  }
  friend bool operator<(const ModInt& a, const ModInt& b) { return a.x < b.x; }
  ModInt& operator+=(const ModInt& m) {
    x += m.x;
    if (x >= MOD) x -= MOD;
    return *this;
  }
  ModInt& operator-=(const ModInt& m) {
    x -= m.x;
    if (x < 0) x += MOD;
    return *this;
  }
  ModInt& operator*=(const ModInt& m) {
    x = (x * m.x) % MOD;
    return *this;
  }
  friend ModInt operator+(const ModInt& a, const ModInt& b) {
    return ModInt(a) += ModInt(b);
  }
  friend ModInt operator-(const ModInt& a, const ModInt& b) {
    return ModInt(a) -= ModInt(b);
  }
  friend ModInt operator*(const ModInt& a, const ModInt& b) {
    return ModInt(a) *= ModInt(b);
  }
  static long long fp(long long u, long long k) {
    if (k == 0) return 1;
    long long res = fp(u, k / 2);
    res = (res * res) % MOD;
    if (k & 1) res = (res * u) % MOD;
    return res;
  }
  ModInt fastpow(long long k) { return ModInt(fp(x, k)); }
  ModInt inv() { return ModInt(fp(x, MOD - 2)); }
};
using num = ModInt<m998>;
const long long borne = 2005;
long long nbCar;
string chaine;
num dp[borne][borne];
num p2[borne];
long long som[borne];
void solve() {
  cin >> chaine;
  nbCar = chaine.size();
  p2[0].x = 1;
  p2[1].x = 2;
  for (long long i = (0); i < (nbCar); ++i) {
    som[i + 1] = som[i] + (chaine[i] == '?');
    p2[i + 1] = p2[i] * p2[1];
  }
  for (long long lo = (nbCar - 1); lo >= (0); --lo)
    for (long long ri = (lo + 1); ri < (nbCar); ++ri) {
      if (chaine[lo] != '(') dp[lo][ri] += dp[lo + 1][ri];
      if (chaine[ri] != ')') dp[lo][ri] += dp[lo][ri - 1];
      if (chaine[lo] != '(' && chaine[ri] != ')')
        dp[lo][ri] -= dp[lo + 1][ri - 1];
      if (chaine[lo] != ')' && chaine[ri] != '(')
        dp[lo][ri] += dp[lo + 1][ri - 1] + p2[som[ri] - som[lo + 1]];
    }
  cout << dp[0][nbCar - 1].x << "\n";
}
