#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;
	}
}

int trazenje_cene(int a[maxN], int x, int y, int c, int min)
{
	int* s0 = new int;
	int* s1 = new int;
	*s0 = 0;
	*s1 = 0;
	for (int b = x;b < y;b++)
	{
		if (a[b] == 0)
		{
			*s0++;
		}
		else if (a[b] == 1)
		{
			*s1++;
		}
	}

	if (s1 > s0)
	{
		min += c;
		promena_subniza(a, x, y);
	}
	else if (s1 = 0)
	{
		delete s0;
		delete s1;
		return min;
	}
	delete s0;
	delete s1;
	min += trazenje_cene(a, x, y / 2, c, min);
	min += trazenje_cene(a, y / 2, y, c, min);
	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;
}