#include <iostream>
#include<string>
using namespace std;
void switch_sub( int S[200000],  int L, int R)
{
	for(long int i=L-1;i<R;i++)
		{
			if(S[i]==0)
				S[i]=1;
			else
                S[i]=0;
		}
}

void novac_formula(int novi_niz[200000], long int *min_novac,long int *novac, long int C, long int N)
	{
	int f=0,m,j,k,z=0;

	int iksic=0;
	for(j=1;j<N-1;j++)
	{
		for(k=j+1;k<=N;k++)
			{
				for(m=j-1;m<k;m++)
				{
					if(novi_niz[m]==0)
						z++;
				}
				if (z+z+C<k-j+1)
				{
				switch_sub(novi_niz,j,k);
				*novac+=C;
				novac_formula(novi_niz,min_novac, novac, C, N);
					switch_sub(novi_niz,j,k);
				}
				z=0;
			}
	}
	for(f=0;f<N;f++)
		iksic+=novi_niz[f];
	if (*novac + iksic < *min_novac)
	*min_novac=*novac+iksic;
	if(*novac!=0)
	*novac-=C;
	}
void calculate_cost(long int N, long int C, long int Q)
{
	long int i,j,k,n;
	int L[200000];
	int R[200000];
	long int z=0;

	long int f=0;
	char Se[200000];
	int S[200000];
	cin>>Se;
	for(i=0;i<N;i++)
	{
		if(Se[i]==48)
			S[i]=0;
		else{
		if(Se[i]==49)
			S[i]=1;
		}
	}
	
	for(i=0;i<Q;i++)
	{
		cin>>L[i]>>R[i];
	}
	long int novac=0;
	long int min_novac;
	int novi_niz[200000];
	for (i=0;i<Q;i++)
	{
		switch_sub(S,L[i],R[i]);
		for (n=0;n<N;n++)
			novi_niz[n]=S[n];
		min_novac=200001;
		novac_formula(S, &min_novac, &novac, C, N);
		cout<<min_novac<<endl;
		


	}
}

int main() {
    long int N,C,Q;
    cin>>N;
    cin>>C;
    cin>>Q;
    calculate_cost(N,C,Q);
    return 0;
}