#include <bits/stdc++.h>

using namespace std;

int transform(int l, int r, string& str) {
    long long res = 0;

    for (int i = l; i < r; ++i) {
        str[i] = !(str[i] - '0') + '0';

        if (str[i] == '1') {
            ++res;
        }
    }

    return res;
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int n, c, q, l, r;
    long long res = 0;

    cin >> n >> c >> q;

    string str;
    cin >> str;

    for (int i = 0; i < q; ++i) {
        cin >> l >> r;
        
        res = transform(l - 1, r, str);

        for (int j = 0; j <= l; ++j) {
            if (str[j] == '1') {
                ++res;
            }
        }

        for (int j = r; j < n; ++j) {
            if (str[j] == '1') {
                ++res;
            }
        }

        cout << res << "\n";
    }
}