You are given a binary string, s, and you have to answer q 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 [l,r] in s is Sl2r−l+Sl+12r−l−1+...+Si2r−i+...+Sr20, where Si represents the integer value of the character at the ith position in s.
Input format
Output format
For each of the type 2 queries, output an integer denoting the decimal value of the binary representation of the queried range modulo 109+7.
Constraints
1≤n,q≤1051≤i≤n1≤l≤r≤n
In the sample test case, we have 3 queries for s=10101
In the first query, we get the substring from position 1 to 5 in s, which is 10101 and it has a decimal value of 21.
21=24+22+20.
In the second query, we flip the bit at the second index, so s becomes 11101.
In the last query, we get the substring from position 1 to 3, which is now 111, and it has a decimal value of 7.
7=22+21+20.