Types: n: int, s: str
Ranges: 1 ≤ n ≤ 10^9, 1 ≤ len(s) ≤ 2×10^6
Addtl Info: The nesting depth of the parentheses in the string is at most 1000. The sum of the lengths of s in all the datasets does not exceed 5×10^6. The end of the input is indicated by a line containing a single zero.