You are given a Binary String A of length N indexed from 0 to N−1. You have to perform 2 queries:-
INPUT FORMAT
First line contains T which denotes the number of test cases.
The first line of each test case contains the binary string A.
The next line contains Q which is the number of queries.
Next Q lines contain the description of queries which may be of either of the 2 types as described in the problem statement.
OUTPUT FORMAT
For each query of Type 0, print the answer in a single line.
CONSTRAINTS
Hints for using the inbuilt code snippet
Let us take the example of sample input. So your function should return the output such that it resembles "0" + "\n" + "3" + "\n" + "2" + "\n" so that it correctly matches the output format as asked. You can use other alternatives too but the output format as rendered by the print function should match the format of sample out.
Note: It is not mandatory to use the code snippet that is provided to you in the editor by default. It is just to make the question more convenient. You can completely remove the default code and submit your solution in the appropriate format.
For the 1st query, the Binary String is 101 i.e 5, hence remainder is 0.
For the 2nd query, Binary String is 1101 i.e 13, hence remainder is 3.