Swapping Brackets

아직 제출이 없습니다시간 제한1.5초메모리 제한1024 MB

문제

You are given a bracket sequence consisting of $N$ open brackets and $N$ closed brackets. Let $S$ be a nonempty set of integers between $1$ and $2N$, inclusively. You can choose two indices in $S$, not necessarily adjacent, and swap the brackets of the bracket sequence at those two positions.

Find the number of $S$ that can result in a proper bracket sequence by repeatedly applying this operation arbitrary number of times.

입력

The first line contains one integer $N$.

The second line contains a string of $2N$ brackets, either ( or ).

출력

Print the number of all possible $S$ in modulo $998\, 244\, 353$. $998\, 244\, 353$ is a prime number.

제한

  • $1\leq N\leq 3000$
  • Given bracket sequence contains $N$ open brackets and $N$ closed brackets.