#include <iostream>

int main() {
	std::ios_base::sync_with_stdio(false);

	int N, C, Q;
	std::cin >> N >> C >> Q;

	std::string S;
	std::cin >> S;

	int L, R;

	for (int i = 0; i < Q; ++i) {
		std::cin >> L >> R;
		--L; --R;

		for (int j = L; j <= R; ++j) {
			if (S[j] == '0') S[j] = '1';
			else S[j] = '0';
		}

		int cena = 0;
		int inv_cena = C;
		int seglen = 0;
		char prev = '0';
		for (int j = 0; j < N; ++j) {
			if (S[j] == '0' && cena == 0 && prev == '0') continue;

			if (S[j] == prev)
				++seglen;
			else {
				if (prev == '1') {
					if (seglen < C) cena += seglen;
					else cena += C;
				}
				else {
					if (seglen < C) inv_cena += seglen;
					else inv_cena += C;
				}

				seglen = 1;
			}

			prev = S[j];
		}
		if (prev == '1') {
			if (seglen < C) cena += seglen;
			else cena += C;
		}

		if (cena < inv_cena) std::cout << cena << "\n";
		else std::cout << inv_cena << "\n";
	}

	return 0;
}