#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
const int mod = 998244353;
char str[N];
long long l[N], r[N], s[N];
long long q_pow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) (res *= a) %= mod;
    (a *= a) %= mod;
    b >>= 1;
  }
  return res;
}
long long c(long long a, long long b) {
  if (a < b) return 0;
  long long x = 1, y = 1;
  for (long long i = a, j = 1; j <= b; i--, j++)
    x = x * i % mod, y = y * j % mod;
  return (x * q_pow(y, mod - 2)) % mod;
}
long long lu(long long a, long long b) {
  if (a < mod && b < mod) return c(a, b);
  return (long long)c(a % mod, b % mod) * lu(a / mod, b / mod) % mod;
}
long long cal[2][N];
void init(long long n, long long a[]) {
  a[0] = 1;
  for (long long i = 1; i <= n; i++) {
    a[i] = (((a[i - 1] * (n - i + 1)) % mod) * q_pow(i, mod - 2)) % mod;
  }
  for (long long i = 1; i <= n; i++) {
    (a[i] += a[i - 1]) %= mod;
  }
}
int main() {
  long long ans = 0;
  scanf("%s", str + 1);
  long long n = strlen(str + 1);
  for (int i = 1; i <= n; i++) {
    l[i] = l[i - 1];
    r[i] = r[i - 1];
    s[i] = s[i - 1];
    if (str[i] == '(')
      l[i]++;
    else if (str[i] == ')')
      r[i]++;
    else if (str[i] == '?')
      s[i]++;
  }
  init(s[n], cal[s[n] & 1]);
  init(s[n] - 1, cal[(s[n] - 1) & 1]);
  long long ss = s[n];
  for (int i = 1; i <= n; i++) {
    long long le = -l[i] + r[n] - r[i] + s[n] - s[i];
    if (str[i] == '(') {
      le = min(le, ss);
      if (le < 0) continue;
      (ans += (cal[ss & 1][le])) %= mod;
    } else if (str[i] == '?') {
      le = min(le - 1, ss - 1);
      if (le < 0) continue;
      (ans += (cal[(ss - 1) & 1][le])) %= mod;
    }
  }
  cout << ans << endl;
}
