#include<bits/stdc++.h>
#define int long long
using namespace std;
template<typename T>inline void read(T &x){
T f=1;char ch=getchar();x=0;
for(;!isdigit(ch);ch=getchar())if(ch=='-')f=-1;
for(;isdigit(ch);ch=getchar())x=(x<<3)+(x<<1)+(ch^48);
x*=f;
}
template<typename T>inline void write(T x){
if(x<0){putchar('-');x=-x;}
if(x<=9){putchar(x^48);return;}
write(x/10);
putchar(x%10^48);
}
const int N=2e5+10,M=61,p=1e9+7;
int f[M][N],g[M][N];
char ch[N<<1];
int s[N<<1];
signed main(){
// freopen("cyy.in","r",stdin);
// freopen("cyy.out","w",stdout);
int n,m,q;
read(n);read(m);read(q);
scanf("%s",ch);
for(int i=0;i<n;i++){
ch[i+n]=ch[i];
}
int lst=-1;
for(int i=0;i<(n<<1);i++){
s[i]=i-lst;
if(ch[i]=='1'){
lst=i;
}
}
for(int i=0;i<n;i++){
f[0][i]=max(1ll,m-s[(i+m+1)%n+n]+1);
g[0][i]=(i+f[0][i])%n;
}
for(int i=1;i<M;i++){
for(int j=0;j<n;j++){
g[i][j]=g[i-1][g[i-1][j]];
f[i][j]=(f[i-1][j]+f[i-1][g[i-1][j]])%p;
}
}
while(q--){
int s,k;
read(s);read(k);
s--;
int ans=s;
s=s%n;
for(int i=M-1;i>=0;i--){
if(k>=(1ll<<i)){
k-=(1ll<<i);
ans=(ans+f[i][s])%p;
s=g[i][s];
}
}
write((ans+1)%p);putchar('\n');
}
return 0;
}