#include <bits/stdc++.h>
#include<ctime>
using namespace std;

int brBlok(string str)
{
    int br = 0;
    for (int i = 0; i < str.size() - 1; i++) {
        if (str[i] != str[i + 1])
            br++;
    }
    return (br + 1) / 2;
}

int BrB(string x)
{
    int count = 0;
    int brb=0;

    for (int i = 0; i < x.size(); i++)
    {
        if (x[i] == '0') {
            if(count!=0)
            brb++;
            count = 0;
        }
        else
        {
            count++;
        }
    }
    if(x[x.size()-1]=='1')
        brb++;
    return brb;
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n,c,q; cin>> n >> c >> q;
    string x; cin >> x;
    pair<int, int> qniz[n];
    for(int i=0;i<q;++i){
        cin >> qniz[i].first >> qniz[i].second;
    }

    for(int i=0;i<q;++i){
        int sum =0;
        for(int j=qniz[i].first-1;j<=qniz[i].second-1;++j){
            if(x[j]=='0')
                x[j]='1';
            else
                x[j]='0';
        }

        if(c==n){
            int br1=0;
            for(int i=0;i<x.size();++i)
                if(x[i]=='1')
                    br1++;
            cout<< br1 << endl;
        }
        else if(c==1){
            cout<<BrB(x) <<endl;
        }
        else
            cout<<BrB(x)*c<<endl;
    }
    return 0;
}