#include <bits/stdc++.h>
using ll = long long;
const int mod = 998244353;
int n, p[2005], p2[2005];
ll d[2005][2005];
char a[2005];
inline int conv(char c) { return c == '(' ? 0 : (c == '?' ? 1 : 2); }
int main() {
  scanf("%s", a + 1);
  n = strlen(a + 1);
  for (int i = 1; i <= n; i++) p[i] = p[i - 1] + (a[i] == '?');
  p2[0] = 1;
  for (int i = 1; i <= n; i++) p2[i] = p2[i - 1] * 2 % mod;
  for (int l = n - 1; l >= 1; l--)
    for (int r = l + 1; r <= n; r++) {
      int type = conv(a[l]) * 3 + conv(a[r]), k = p[r - 1] - p[l];
      ll &f = d[l][r];
      switch (type) {
        case 0:
          f = d[l][r - 1];
          break;
        case 1:
          f = d[l][r - 1] + d[l + 1][r - 1] + p2[k];
          break;
        case 2:
          f = d[l + 1][r - 1] + p2[k];
          break;
        case 3:
          f = d[l][r - 1];
          break;
        case 4:
          f = d[l][r - 1] + d[l + 1][r] + p2[k];
          break;
        case 5:
          f = d[l + 1][r] + d[l + 1][r - 1] + p2[k];
          break;
        case 6:
          f = d[l + 1][r - 1];
          break;
        case 7:
          f = d[l + 1][r];
          break;
        case 8:
          f = d[l + 1][r];
          break;
      }
      f = ((f % mod) + mod) % mod;
    }
  printf("%lld", d[1][n]);
  return 0;
}
