Controllers

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

문제

You are at your grandparents’ house and you are playing an old video game on a strange console. Your controller has only two buttons and each button has a number written on it.

Initially, your score is 00. The game is composed of nn rounds. For each 1in1 ≤ i ≤ n, the ii-th round works as follows.

On the screen, a symbol s_is\_i appears, which is either + (plus) or - (minus). Then you must press one of the two buttons on the controller once. Suppose you press a button with the number xx written on it: your score will increase by xx if the symbol was + and will decrease by xx if the symbol was -. After you press the button, the round ends.

After you have played all nn rounds, you win if your score is 00.

Over the years, your grandparents bought many different controllers, so you have qq of them. The two buttons on the jj-th controller have the numbers a_ja\_j and b_jb\_j written on them. For each controller, you must compute whether you can win the game playing with that controller.

입력

The first line contains a single integer nn (1n21051 ≤ n ≤ 2 \cdot 10^5) — the number of rounds.

The second line contains a string ss of length nn — where s_is\_i is the symbol that will appear on the screen in the ii-th round. It is guaranteed that ss contains only the characters + and -.

The third line contains an integer qq (1q1051 ≤ q ≤ 10^5) — the number of controllers.

The following qq lines contain two integers a_ja\_j and b_jb\_j each (1a_j,b_j1091 ≤ a\_j , b\_j ≤ 10^9) — the numbers on the buttons of controller jj.

출력

Output qq lines. On line jj print YES if the game is winnable using controller jj, otherwise print NO.