Problem: teams participate in a playoff tournament. The tournament consists of games. They are held as follows: first of all, the teams are split into pairs: team plays against team , team plays against team (exactly in this order), and so on (so, games are played in that phase). When a team loses a game, it is eliminated, and each game results in elimination of one team (there are no ties). After that, only teams remain. If only one team remains, it is declared the champion; otherwise, games are played: in the first one of them, the winner of the game " vs " plays against the winner of the game " vs ", then the winner of the game " vs " plays against the winner of the game " vs ", and so on. This process repeats until only one team remains.
For example, this picture describes the chronological order of games with :
Let the string consisting of characters describe the results of the games in chronological order as follows:
- if is 0, then the team with lower index wins the -th game;
- if is 1, then the team with greater index wins the -th game;
- if is ?, then the result of the -th game is unknown (any team could win this game).
Let be the number of possible winners of the tournament described by the string . A team is a possible winner of the tournament if it is possible to replace every ? with either 1 or 0 in such a way that team is the champion.
You are given the initial state of the string . You have to process queries of the following form:
- — replace with character , and print as the result of the query.
Input Format: The first line contains one integer ().
The second line contains a string consisting of characters — the initial state of the string . Each character is either ?, 0, or 1.
The third line contains one integer () — the number of queries.
Then lines follow, the -th line contains an integer and a character (; is either ?, 0, or 1), describing the -th query.
Output Format: For each query, print one integer — .