#include<bits/stdc++.h>
#define gc getchar()
#define rep(u,x,y) for(ll u=x;u<=y;++u)
using namespace std;
typedef long long ll;
const ll N=1e6+1,Mod=1e9+7;
ll read(){
ll x=0,w=1;
char ch=gc;
while(ch<'0'||ch>'9')((ch=='-')&&(w=-1,0)),ch=gc;
while(ch>='0'&&ch<='9')x=(x<<3)+x+x+(ch^48),ch=gc;
return x*w;
}
bool readb(){
char ch=gc;
while(ch<'0'||ch>'9')ch=gc;
return ch^48;
}
void wrt(ll x){
if(x<0)putchar('-'),x=-x;
if(x>9)wrt(x/10);
putchar(x%10^48);
}
bool a[N];
ll pre[N],n,m,q,ins,idx,x,y,ans,S;
struct {
ll val,st;
}to[N][31];
ll lowbit(ll x){return x&-x;}
void tomod(ll&x){x=(x-1)%n+1;}
ll find_low(ll x){
ll l=0,r=2*idx,mid;
while (l < r){
mid = (l + r + 1) >> 1;
if (pre[mid]<=x) l = mid;
else r = mid - 1;
}
return pre[l];
}
void init(){
rep(i,1,30){
rep(pos,1,n){
to[pos][i].st=to[pos][i-1].st;
to[pos][i].val=to[to[pos][i-1].val][i-1].val;
to[pos][i].st+=to[to[pos][i-1].val][i-1].st;
to[pos][i].st%=Mod;
}
}
}
int main(){
n=read(),m=read(),q=read(),ins=m%n;
rep(i,1,n){
a[i]=readb();
if(a[i])++idx,pre[idx]=pre[idx+n]=i;
}
rep(i,1,idx)pre[i+idx]=pre[i]+n;
rep(pos,1,n){
ll t=find_low(pos+ins);
to[pos][0].val=max((pos+1),t);
to[pos][0].st=int(m/n)*n+to[pos][0].val-pos;
tomod(to[pos][0].val);
}
init();
while(q--){
S=x=read(),y=read(),ans=0;
tomod(x);
while(y){
int len=log2(lowbit(y));
ans=(ans+to[x][len].st)%Mod;
x=to[x][len].val;
y-=lowbit(y);
}
wrt((S+ans)%Mod),putchar('\n');
}
return 0;
}