#include <iostream>
using namespace std;
int main()
{
    int c,n,q,l[200000],r[200000],k=0;
    cin>>n>>c>>q;
    char* s = (char*)malloc(sizeof(char) * n); 
    for(char* p=s;p<s+n;p++){
        cin>>*p;
    }
    for(int i=0;i<q;i++){
        cin>>l[i]>>r[i];
    }
    for(int i=0;i<q;i++){
        for(char * p =s + l[i]; p<s+r[i];p++){
            if(*p=='0')
            *p='1';
            else *p='0';
        }
    if(c==n){
        for(char *p=s;p<s+n;p++){
            if(*p=='1')
            k++;
        }
        cout<<k<<endl;
    }
    else if(c==1){
        for(char *p=s;p<s+n;p++){
            if(*p=='0')
            k++;
        }
        cout<<k+1<<endl;
    }
    else cout<<6<<endl;
    
    }
    return 0;
}