You are given a binary string, , and you have to answer queries in order.
A binary string is a string consisting of only 0's and 1's.
There are two types of queries:
The decimal value of some range in is , where represents the integer value of the character at the position in .
Input format
Output format
For each of the type queries, output an integer denoting the decimal value of the binary representation of the queried range modulo .
Constraints
In the sample test case, we have queries for
In the first query, we get the substring from position 1 to 5 in s, which is and it has a decimal value of 21.
.
In the second query, we flip the bit at the second index, so s becomes .
In the last query, we get the substring from position 1 to 3, which is now , and it has a decimal value of 7.
.