A regular bracket sequence is a sequence of '(' and ')' characters defined as follows:
For a string S that consists of only '(' and ')' characters, consider a sequence of M operations that are of one of the following types:
Input format
Output format
For the query of the type Q , print the length of the longest regular bracket sequence starting at index i.
Input Constraints
1≤|S|≤2×105
1≤M≤2×105
1≤iquery≤N
After every query: