#include <iostream>

using namespace std;

const int maxN = 200;

void promena_substringa(char s[maxN], int i, int j)
{
	for (int x = i;i <= j;i++)
	{
		if (s[x] == '0')
			s[x] = '1';
		else
			s[x] = '0';
	}
}

void promena_subniza(int s[maxN], int i, int j)
{
	for (int x = i;i < j;i++)
	{
		if (s[x] == 0)
			s[x] = 1;
		else
			s[x] = 0;
	}
}

void grupisanje(int s[maxN], int *s0, int *s1, int y, int x)
{
	for (int a = x;a < y;a++)
	{
		if (s[a] == 0)
		{
			*s0++;
		}
		else if (s[a] == 1)
		{
			*s1++;
		}
	}
}
int trazenje_cene(int a[maxN], int x, int y, int c, int min)
{
	int s0=0,s1=0;
	grupisanje(a, &s0, &s1, y, x);
	if (s1 > s0)
	{
		min += c;
		promena_subniza(a, x, y);
	}
	else if (s1 = 0)
	{
		return min;
	}
	min += trazenje_cene(a, x, y / 2, c, min);
	min += trazenje_cene(a, y / 2, y, c, min);
    delete s0;
    delete s1;
	return min;
}

int main()
{
	int N, Q, C;
	char S[maxN];
	int L[maxN], R[maxN];
	cin >> N;
	cin >> C;
	cin >> Q;
	
	for (int i = 0;i < N;i++)
	{
		cin >> S[i];
	}
	for (int i = 0;i < Q;i++)
	{
		cin >> L[i];
		cin >> R[i];
	}

	for (int i = 0;i < Q;i++)
	{
		promena_substringa(S, L[i] - 1, R[i] - 1);
		int a[maxN];
		for (int i = 0;i < N;i++)
		{
			a[i] = int(S[i]) - 48;
		}
		cout << trazenje_cene(a, 0, N, C, 0)<<endl;
	}

	return 0;
}