样例通过了,但是Subtask #4 RE,其余的WA,求调
// lowbit运算
#include<bits/stdc++.h>
using namespace std;
const int N = 1e9 + 7;
#define ll long long
ll lowbit(ll x){
if(x == 0) return 0;
ll ans = 0;
while(x){
if(x & 1) break;
else ans++;
x >>= 1;
}
return 1 << ans;
}
ll highbit(ll x){
if(x == 0) return 0;
ll ans = 0;
while(x >>= 1){
ans++;
// x >>= 1;
}
return 1 << ans;
}
int main(){
ll n = 0, q = 0;
scanf("%lld%lld",&n,&q);
string s;
std::cin.get();
getline(cin, s);
while(q--){
ll l = 0, r = 0, x = 0;
cin>>l>>r>>x;
for(ll i = l - 1; i < r; i++){
if(s[i] == '0') x = (x + lowbit(x));
else if(s[i] == '1') x = (x + highbit(x));
}
cout<<x % N<<endl;;
}
return 0;
}