#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
struct ext {
  int kto, len;
};
char typ[] = {'(', ')'};
char str[3000];
ext dp[2005][2005];
int vis[2005][2005];
void care(int &x) {
  if (x >= mod) x %= mod;
  while (x < 0) x += mod;
}
ext dp_func(int st, int en) {
  ext six;
  six.len = 0;
  six.kto = 1;
  if (st > en) return six;
  if (st == en) {
    if (str[st] == '?') six.kto = 2;
    return six;
  }
  if (vis[st][en]) return dp[st][en];
  ext ret;
  ret.kto = 0;
  ret.len = 0;
  for (int i = 0; i < 2; i++) {
    for (int j = 1; j < 2; j++) {
      char x, y;
      if (str[st] == '?' || str[st] == typ[i])
        x = typ[i];
      else
        continue;
      if (str[en] == '?' || str[en] == typ[j])
        y = typ[j];
      else
        continue;
      if (x == '(' && y == ')') {
        ext ps = dp_func(st + 1, en - 1);
        ret.kto += ps.kto;
        ret.len += (ps.kto + ps.len) % mod;
        ret.kto %= mod;
        ret.len %= mod;
        care(ret.len);
        care(ret.kto);
        continue;
      }
    }
  }
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      char x, y;
      if (str[st] == '?' || str[st] == typ[i])
        x = typ[i];
      else
        continue;
      if (str[en] == '?' || str[en] == typ[j])
        y = typ[j];
      else
        continue;
      if (x == ')' && y == '(') {
        ext ps = dp_func(st + 1, en - 1);
        ret.kto -= ps.kto;
        ret.len -= ps.len;
        care(ret.len);
        care(ret.kto);
        continue;
      }
    }
  }
  if (str[st] == ')' || str[st] == '?') {
    ext ps = dp_func(st + 1, en);
    ret.len += ps.len;
    ret.kto += ps.kto;
    care(ret.len);
    care(ret.kto);
  }
  if (str[en] == '(' || str[en] == '?') {
    ext ps = dp_func(st, en - 1);
    ret.len += ps.len;
    ret.kto += ps.kto;
    care(ret.len);
    care(ret.kto);
  }
  vis[st][en] = 1;
  return dp[st][en] = ret;
}
int main() {
  scanf("%s", str);
  int n = strlen(str);
  ext ans = dp_func(0, n - 1);
  cout << ans.len << endl;
}
