#D11694. A + B
A + B
A + B
Ikta, who was in trouble because he couldn't come up with an idea for the problem to be presented at the training camp of the programming contest, consulted with a friend one day.
Mr. Ikta "I want to create a problem that cannot be solved without using such an algorithm. Is there anything?"
Friend "Then why not think about something like this?"
In this way, the friend came up with the idea that would be the basis for the following problems.
Given binary numbers A and B, process the following query.
- Output query: Outputs the number of 1s when max {x is expressed in binary | A ≤ x <A + B}
- A change query: Inverts the i-th bit (0-origin) from the least significant bit of A
- B change query: Inverts the i-th bit (0-origin) from the least significant bit of B
Note that the i-bit is represented by 0-origin. That is, the 0th bit from the least significant bit of A represents the least significant bit.
Input
The input is given in the following format.
N A B Q1 ... QN
The number of queries N, binary numbers A and B are given in the first line.
The following query is given in the 2nd to N + 1 lines.
- Q
- A i
- B i
Q represents the output query, and A i and B i represent the change query that inverts the i-th bit from the least significant bit of A and the i-th bit from the least significant bit of B, respectively.
Constraints
Each variable being input satisfies the following constraints.
- 1 ≤ N <300,000
- 1 ≤ | A |, | B | ≤ 300,000 (| A | is the length of A)
- In the query A i, 0 ≤ i <| A |
- In the query B i 0 ≤ i <| B |
- B can never be 0
Output
Print the answer on one line for each output query.
Examples
Input
4 10000 00101 Q A 0 B 1 Q
Output
3 4
Input
9 0110111101 0010100111 Q B 4 Q A 4 Q B 9 Q A 8 Q
Output
9 9 9 10 9
inputFormat
outputFormat
Output query: Outputs the number of 1s when max {x is expressed in binary | A ≤ x <A + B}
- A change query: Inverts the i-th bit (0-origin) from the least significant bit of A
- B change query: Inverts the i-th bit (0-origin) from the least significant bit of B
Note that the i-bit is represented by 0-origin. That is, the 0th bit from the least significant bit of A represents the least significant bit.
Input
The input is given in the following format.
N A B Q1 ... QN
The number of queries N, binary numbers A and B are given in the first line.
The following query is given in the 2nd to N + 1 lines.
- Q
- A i
- B i
Q represents the output query, and A i and B i represent the change query that inverts the i-th bit from the least significant bit of A and the i-th bit from the least significant bit of B, respectively.
Constraints
Each variable being input satisfies the following constraints.
- 1 ≤ N <300,000
- 1 ≤ | A |, | B | ≤ 300,000 (| A | is the length of A)
- In the query A i, 0 ≤ i <| A |
- In the query B i 0 ≤ i <| B |
- B can never be 0
Output
Print the answer on one line for each output query.
Examples
Input
4 10000 00101 Q A 0 B 1 Q
Output
3 4
Input
9 0110111101 0010100111 Q B 4 Q A 4 Q B 9 Q A 8 Q
Output
9 9 9 10 9
样例
9 0110111101 0010100111
Q
B 4
Q
A 4
Q
B 9
Q
A 8
Q
9
9
9
10
9
</p>