#include <iostream>

using namespace std;

int main()
{
    int n, c, q;
    cin >> n >> c >> q;
    string s;
    cin >> s;
    int l[q], r[q];
    int kec, nula;
    for(int i = 0; i < q; i++){
        kec = 0;
        nula = 0;
        cin >> l[i] >> r[i];
        for(int j = (l[i]-1); j < (r[i] -1); j++){
            if(s[j] == 0)
                s[j] = 1;
            else
                s[j] = 0;
        }
        for(int k = 0; k < n; k++){
            if(s[k] == 0)
                nula++;
            else
                kec++;
        }
        if(kec > (c+nula))
            cout << (c+nula) << endl;
        else
            cout << kec << endl;

    }
    return 0;
}