#include <bits/stdc++.h>
const long long N = 2010;
const long long MOD = 998244353;
long long n;
char s[N];
long long a[N], sum[N];
long long dp[N][N];
long long pow2[N];
signed main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  for (long long i = 1; i <= n; ++i) {
    if (s[i] == '(') a[i] = 1;
    if (s[i] == ')') a[i] = -1;
    sum[i] = sum[i - 1] + (!a[i]);
  }
  pow2[0] = 1;
  for (long long i = 1; i < N; ++i) pow2[i] = (pow2[i - 1] << 1) % MOD;
  for (long long i = 2; i <= n; ++i)
    for (long long j = 1; j <= n - i + 1; ++j) {
      long long t = i + j - 1;
      if (a[t] != -1) dp[j][t] = (dp[j][t] + dp[j][t - 1]) % MOD;
      if (a[j] != 1)
        dp[j][t] = (dp[j][t] + dp[j + 1][t] -
                    (a[t] == -1 ? 0 : dp[j + 1][t - 1]) + MOD) %
                   MOD;
      if (a[j] != -1)
        dp[j][t] = (dp[j][t] + (a[t] == 1 ? 0
                                          : (pow2[(sum[t - 1] - sum[j])]) +
                                                dp[j + 1][t - 1])) %
                   MOD;
    }
  printf("%lld\n", dp[1][n]);
  return 0;
}
