#include<bits/stdc++.h>
using namespace std;
#define N 200005
#define LL long long
char ch[N<<1];
const LL mod=1000000007;
LL n,m,q,pre[N<<1],to[N][60],sum[N][60];
int main(){
scanf("%lld%lld%lld%s",&n,&m,&q,ch+1);
for(int i=1;i<=n;i++) ch[i+n]=ch[i];
for(int i=1;i<=n*2;i++) pre[i]=(ch[i]=='1'?i:pre[i-1]);
for(int i=1;i<=n;i++){
int t=i+(m-1)%n+1;
if(!pre[t]) to[i][0]=i%n+1;
else to[i][0]=((m>=(pre[t]-i+n-1)%n+1?pre[t]:(i+1))-1)%n+1;
int ned=(to[i][0]-i+n)%n;
sum[i][0]=(m%n>=ned?m/n*n+ned:(m/n-1)*n+ned)%mod;
}
for(int i=1;i<60;i++)
for(int j=1;j<=n;j++)
to[j][i]=to[to[j][i-1]][i-1],sum[j][i]=(sum[j][i-1]+sum[to[j][i-1]][i-1])%mod;
for(LL i=1,x,y;i<=q;i++){
scanf("%lld%lld",&x,&y);LL ans=x%mod;x=(x-1)%n+1;
for(int j=59;j>=0;j--) if(y>=(1ll<<j)) y-=(1ll<<j),ans=(ans+sum[x][j])%mod,x=to[x][j];
printf("%lld\n",ans);
}
}