#include <iostream>
#include <string>
#include <vector>
#include <cstdbool>
using namespace std;

void coin_flipping(string &s, int i, int j) {
	for (i; i < j + 1; i++) {
		if (s[i - 1] == '0') s[i - 1] = '1';
		else s[i - 1] = '0';
	}
}

int deo_cene(string s, int& ik, int c) {
	int s0 = 0, s1 = 0, lower, j = 0, k;
	double  min = 0;
	for (int i=ik; i < s.length(); i++) {
		if (s[i] == '1') s1++;
		else s0++;
		if (s1 > (s0 + c)) lower = s0 + c;
		else lower = s1;
		j++;
		if (j == 1 || (lower * 200000 / j) < min || (min*j)<(lower*200000)) {
			min = (double)(lower * 200000 / j);
			k = j;
		}
	}
	ik += k;
	return lower;
}

int ukupna_cena(string s, int c) {
	int s0 = 0, s1 = 0, cena = 0;
	bool x = true;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == '1') {
			cena += deo_cene(s, i, c);
		}
	}
	return cena;
}

int main() {
	int n, c, q;
	cin >> n >> c >> q;
	string s;
	s.reserve(n);
	cin >> s;
	vector<int>l(q);
	vector<int>r(q);
	vector<int>cena(q);
	for (int i = 0; i < q; i++) {
		cin >> l[i] >> r[i];
		coin_flipping(s, l[i], r[i]);
		cena[i] = ukupna_cena(s, c);
	}
	for (int i = 0; i < q; i++) {
		cout << cena[i] << endl;
	}
	return 0;
}