#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<map>
#define re register
#define ll long long
using namespace std;
const ll mod=1e9+7;
ll n,m;
int q;
char s[4000005];
ll sum[2000005];
ll f[2000005][65];//62
ll calc(ll x){
return sum[x%n]+sum[n]*(x/n);
}
ll query(int l,int r){
return calc(r)-calc(l-1);
}
int mo(int x){
if(x%n==0) return n;
return x%n;
}
int main(){
scanf("%lld%lld%d%s",&n,&m,&q,s+1);
for(int i=1;i<=n;++i){
sum[i]=sum[i-1]+(s[i]=='1');
}
for(int i=1;i<=n;++i){
int l=i+1,r=i+m,mid;
while(l<r){
mid=(l+r+1)>>1;
if(query(mid,i+m)>=1) l=mid;
else r=mid-1;
}
if(query(l,l)>=1) f[i][0]=l-i;
else f[i][0]=1;
}
// cout<<"*"<<f[1][0]<<" "<<f[2][0]<<" "<<mo(1+f[1][0])<<" "<<f[1][1]<<endl;
for(int j=1;j<=62;++j){
for(int i=1;i<=n;++i){
f[i][j]=f[i][j-1]+f[mo(i+f[i][j-1])][j-1];
// cout<<i<<" "<<j<<" "<<f[i][j]<<" "<<f[i][j-1]<<" "<<f[mo(i+f[i][j-1])][j-1]<<endl;
}
}
while(q--){
ll s,k;
scanf("%lld%lld",&s,&k);
ll ans=s%mod;
for(int i=0;i<62;++i){
if(k&((ll)1<<i)){
s%=n;
if(s==0) s=n;
ans=(ans+f[s][i])%mod;
s+=f[s][i];
// cout<<"//"<<s<<endl;
}
}
printf("%lld\n",ans);
}
return 0;
}