#include<bits/stdc++.h>
using namespace std;
int N,C,Q,L,R,sol,proslip,proslik,sadp,sadk,op1,op2,op3,ps;
bool sac;
string s;
int main(){
  cin>>N>>C>>Q;
  cin>>s;
  while(Q--){
    cin>>L>>R;
    sol=0;
    for(int i=L-1; i<R; i++)
      s[i]=(s[i]-'0'+1)%2+'0';
    proslip=0;
    proslik=-1;
    sadp=0;
    sadk=0;
    sac=false;
    ps=0;
    for(int i=0; i<s.size(); i++){
      if(s[i]=='0')continue;
      sadp=i;
      while(i<s.size() and s[i]=='1')i++;
      sadk=i-1;
      op3=sadk-sadp+1;
      op2=C;
      op1=(sadp-proslik-1);
      if(sac==false)op1+=C;
      if(ps==3)op1-=(proslik-proslip+1);
      if(op1<=op2 and op1<=op3){
        ps=1;
        sac=true;
        sol+=op1;
        proslik=sadk;
      }
      if(op2<op1 and op2<=op3){
        ps=2;
        sac=true;
        sol+=op2;
        proslip=sadp;
        proslik=sadk;
      }
      if(op1>op3 and op2>op3){
        ps=3;
        sac=false;
        sol+=op3;
        proslip=sadp;
        proslik=sadk;
      }
    }
    cout<<sol<<endl;
  }

  return 0;
}