#include <bits/stdc++.h>
#define pb push_back
#define pf push_front
#define fi first
#define se second

using namespace std;
typedef long long ll;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n, c, q, l ,r;
	string s;
	cin >> n >> c >> q >> s;
	while(q--)
    {
        cin >> l >> r;
        for(ll i=l-1; i<r; i++)
        {
            if(s[i]=='1')
            {
                s[i]='0';
            }
            else
            {
                s[i]='1';
            }
        }
        ll res=0;
        for(ll i=0; i<s.size(); i++)
        {
            if(s[i]=='1')
            {
                res++;
            }
        }
        cout << res << "\n";
    }
}