#include using namespace std; constexpr int mod = 998244353; int dp[201][201][201]; long long tmp1[201],tmp2[201]; long long modpow(long long a,long long b) { long long ans = 1; while(b) { if(b & 1) { (ans *= a) %= mod; } (a *= a) %= mod; b /= 2; } return ans; } vector> Mul(vector> A,vector> B) { vector>ans(A.size(),vector(A.size())); for(int i = 0; i < A.size(); i++) { for(int j = 0; j < A.size(); j++) { for(int k = 0; k < A.size(); k++) { ans[i][j] += A[i][k]*B[k][j]%mod; ans[i][j] %= mod; } } } return ans; } vector> Pow(vector> A,long long B) { vector>ans(A.size(),vector(A.size())); ans[0][0] = 1; while (B) { if(1 & B) { ans = Mul(ans,A); } A = Mul(A,A); B /= 2; } return ans; } long long fac[200005], finv[200005], inv[200005]; void COMinit() { fac[0] = fac[1] = finv[0] = finv[1] = inv[1] = 1; for (int i = 2; i < 200005; i++) { fac[i] = fac[i - 1] * i % mod; inv[i] = mod - inv[mod % i] * (mod / i) % mod; finv[i] = finv[i - 1] * inv[i] % mod; } } long long COM(int n, int k){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % mod) % mod; } long long COM2(int K) { return tmp1[K]*modpow(tmp2[K],mod-2)%mod; } void modplus(int &x,int y) { x += y; if(x >= mod) x -= mod; } int main() { string S; int K; cin >> S >> K; int N = (int)S.size(); dp[0][0][0] = 1; for(int i = 0; i < N; i++) { for(int j = 0; j < N; j++) { for(int k = 0; k < N; k++) { int f = ('(' != S[i]); modplus(dp[i+1][j+1][k+f],dp[i][j][k]); f ^= 1; modplus(dp[i+1][j-1][k+f],dp[i][j][k]); } } } tmp1[0] = K; for(int i = K-1; i >= K-N; i--) { tmp1[K-i] = tmp1[K-i-1]*max(1,i)%mod; } tmp2[0] = 1; for(int i = 1; i <= N; i++) { tmp2[i] = tmp2[i-1]*i%mod; } vector>A(N/2+1,vector(N/2+1)); for(int i = 0; i <= N/2; i++) { A[i][i] = N/2*(N-1)-i*i-(N/2-i)*(N/2-i); if(i+1 <= N/2) { A[i][i+1] = (N/2-i)*(N/2-i); } if(i) { A[i][i-1] = i*i; } } A = Pow(A,K); COMinit(); int ans = 0; for(int i = 0; i <= N; i += 2) { modplus(ans,COM2(i/2)*dp[N][0][i]%mod*modpow(COM(N/2,i/2)*COM(N/2,i/2)%mod,mod-2)%mod*A[0][i/2]%mod); } cout << ans << endl; }