#include<iostream>
using namespace std;
main(){
int N,C,Q;
cin>>N>>C>>Q;
int L[Q];
int R[Q];
int br=0;
string s;
cin>>s;
string s1 = s;
for (int i = 0; i < Q; i++)
{
    cin>>L[i];
    cin>>R[i];
}
for(int i = 0; i < Q; i++)
{
    for (int j = L[i]-1; j <= R[i]-1; j++)
    {
        if (s[j] == 48) s[j] = 49;
        else s[j] = 48;
    }
    for (int j = 0; j < s.size(); j++)
    {
        if (s[j] == 49) br++;
    }
    cout<<br<<endl;
    br=0;
    s = s1;
}
}