#include <iostream>

using namespace std;

const int maxN = 200;

void promena_subniza(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';
	}
}
int trazenje_cene(char s[maxN], int n, int c,int co, int min)
{
	int k0x[maxN], k0y[maxN], k1x[maxN], k1y[maxN];
	bool b = true;
	for (int i = 0;i < n;i++)
	{
		if (s[i] != '0')
		{
			b = false;
			break;
		}
	}
	if (b)
		return min;
	else
	{
		int c1 = 0, c0 = 0;
		if (s[0] == '0')
		{
			k0x[0] = 0;
			b = false;
		}
		else
		{
			k1x[0] = 0;
			b = true;
		}

		for (int i = 1;i < n;i++)
		{
			if (s[i] == '0' && b)
			{
				k1y[c1] = i - 1;
				c1++;
				k0x[c0] = i;
				b = false;
			}
			else if (s[i] == '1' && !b)
			{
				k0y[c0] = i - 1;
				c0++;
				k1x[c1] = i;
				b = true;
			}
		}
		int su = 0;
		int x = k1x[0], y;

		for (int i = 0;i < c1 && i < co;i++)
		{
			int tren_c0;
			bool test = false;
			for (int j = 0;j < c0;j++)
			{
				if (k0x[j] == k1y[i] + 1)
				{
					tren_c0 = j;
					test = true;
					break;
				}
			}
			if (test)
				su += (k0y[tren_c0] - k0x[tren_c0]) + 1;
			y = k1y[i];
		}
		if (su > c)
		{
			min += c;
			promena_subniza(s, x, y);
		}
		return trazenje_cene(s, n, c, co - 1, 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_subniza(S, L[i] - 1, R[i] - 1);
		cout << trazenje_cene(S, N, C,N,0)<<endl;
	}

	return 0;
}