Brackets#1994

Brackets

1 segundo
64 megabytes
Fácil (≈1000)

The sequence of round brackets and queries are given. Each query inverts a certain bracket (an opening bracket becomes closing, and vice versa). After each query, it is required to determine whether the current bracket sequence is correct.

A bracket sequence is called correct if the number of opening brackets is equal to the number of closing brackets, and in any prefix of the sequence the number of opening brackets is not less than the number of closing brackets.

Entrada

The first line contains a sequence of (1 \leq n \leq 100\ 000) round brackets. The second line contains the number of queries (1 \leq k \leq 100\ 000). Each of the next lines contains one number (0 \leq p < n) — the index of the bracket to be inverted.

Salida

Print lines; each line must contain either '+' or '–' depending on whether the bracket sequence is correct after the current query.

Ejemplos

Ejemplo 1

Loading
Loading