#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long a, long long p) {
  a %= 998244353ll;
  long long r = 1;
  while (p) {
    if ((p & 1)) {
      r = (r * a) % 998244353ll;
    }
    a = (a * a) % 998244353ll;
    p >>= 1;
  }
  return r;
}
struct Modulo {
  long long value;
  Modulo() { value = 0; }
  Modulo(long long v) {
    v %= 998244353ll;
    if (v < 0) {
      v += 998244353ll;
    }
    value = v;
  }
  Modulo operator+(Modulo x) { return Modulo(value + x.value); }
  Modulo operator-(Modulo x) { return Modulo(value - x.value); }
  Modulo operator*(Modulo x) { return Modulo(value * x.value); }
  Modulo operator/(Modulo x) {
    return Modulo(value * bigmod(x.value, 998244353ll - 2));
  }
  Modulo operator+(long long x) { return Modulo(value + x); }
  Modulo operator-(long long x) { return Modulo(value - x); }
  Modulo operator*(long long x) { return Modulo(value * x); }
  Modulo operator/(long long x) {
    return Modulo(value * bigmod(x, 998244353ll - 2));
  }
  bool operator==(long long x) { return value == x; }
  bool operator!=(long long x) { return value != x; }
  bool operator==(Modulo x) { return value == x.value; }
  bool operator!=(Modulo x) { return value != x.value; }
  void print() { printf("%lld\n", value); }
};
Modulo ONE = Modulo(1);
Modulo ZERO = Modulo(0);
Modulo dp[2009][2009];
int cnt[2009];
char str[2009];
int main() {
  int n, i;
  scanf("%s", str + 1);
  n = strlen(str + 1);
  for (i = 1; i <= n; i++) {
    cnt[i] = cnt[i - 1] + (str[i] == '?');
  }
  for (int len = 2; len <= n; len++) {
    for (int l = 1, r = len; r <= n; l++, r++) {
      if (str[l] != '(') {
        dp[l][r] = dp[l][r] + dp[l + 1][r];
      }
      if (str[r] != ')') {
        dp[l][r] = dp[l][r] + dp[l][r - 1];
      }
      if (str[l] != '(' && str[r] != ')') {
        dp[l][r] = dp[l][r] - dp[l + 1][r - 1];
      }
      if (str[l] != ')' && str[r] != '(') {
        dp[l][r] = dp[l][r] + dp[l + 1][r - 1] + bigmod(2, cnt[r - 1] - cnt[l]);
      }
    }
  }
  Modulo ans = dp[1][n];
  ans.print();
  return 0;
}
