#include <bits/stdc++.h>
using namespace std;
const long long p = 998244353;
long long l[2010][2010], r[2010][2010];
char s[2020];
signed main() {
  scanf("%s", s + 1);
  long long n = strlen(s + 1);
  l[0][0] = 1;
  r[n + 1][0] = 1;
  for (long long i = 1; i <= n; i++) {
    if (s[i] == '(' || s[i] == '?') {
      for (long long j = 1; j <= n; j++)
        l[i][j] = (l[i][j] + l[i - 1][j - 1]) % p;
    }
    if (s[i] == ')' || s[i] == '?')
      for (long long j = 0; j <= n; j++) {
        l[i][j] = (l[i - 1][j] + l[i][j]) % p;
      }
  }
  for (long long i = n; i >= 1; i--) {
    if (s[i] == ')' || s[i] == '?')
      for (long long j = 1; j <= n; j++)
        r[i][j] = (r[i][j] + r[i + 1][j - 1]) % p;
    if (s[i] == '(' || s[i] == '?')
      for (long long j = 0; j <= n; j++) r[i][j] = (r[i + 1][j] + r[i][j]) % p;
  }
  long long ans = 0;
  for (long long i = 2; i <= n; i++) {
    long long x = min(i - 1, n - i + 1);
    for (long long j = 1; j <= x; j++) {
      ans = (ans + l[i - 1][j] * r[i][j] % p * j % p) % p;
    }
  }
  printf("%lld", ans);
}
