#include <iostream>

using namespace std;

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