e-olymp
Competitions

15-19 февраля. Старшая лига - Дерево отрезков - множественная модификация

Brackets

The sequence of n opening and closing parentheses are given. You have k queries for changing a single bracket to opposite (the opening bracket changes to closing and otherwise). After each query you must answer does the current sequence of brackets is correct.

The bracket sequence is called correct if the number of opening brackets equals to the number of closing, and in any prefix of the sequence the number of opening brackets is no less then number of closing brackets.

Input

The first line contains n (1n100 000) parentheses. The second line contains the number of queries k (1k100 000). Each of the next k lines contains one number p (0p < n) - the bracket number that must be changed to opposite.

Output

Print k lines. In each line print either '+' or '' depending on the correctness of the current bracket sequence after executing the current query.

Time limit 1 second
Memory limit 64 MiB
Input example
()
5
0
0
1
1
0
Output example
-
+
-
+
-