#include<bits/stdc++.h>
# define endl            '\n'
# define clr(x,a)        memset(x,a,sizeof(x))
# define PI              3.14159265358979323846
# define vi              vector<int>
# define fo(i,n)         for(int i=1;i<=n;i++)
# define all(a)          a.begin(), a.end()
# define deb(x)          cout<<#x<<" = "<<x<<endl;
# define pb              push_back
# define sc              scanf
# define pr              printf
# define tc              int t; cin>>t; while(t--)
typedef long long ll;
using namespace std;
///                                         jeeeee 4 bodaaaa
const int mxN=200006, mxM=1000006, mod=1e9+7;
int n, c, q, ps[mxN], l, r;
string s;
void update(){
   for(int i=l; i<=r; i++){
      if(s[i]=='1') s[i]='0';
      else s[i]='1';
   }
   for(int i=l; i<=n; i++)
      ps[i]=ps[i-1]+(s[i]=='1');
}
int main(){
   sc("%d %d %d", &n, &c, &q);
   cin>>s;
   s='@'+s;
   for(int i=1; i<=n; i++){
      ps[i]=ps[i-1]+(s[i]=='1');
   }
   while(q--){
      sc("%d %d", &l, &r);

      update();
//      cout<<s<<endl;
//      for(int i=1; i<=n; i++) cout<<ps[i]<<" ";
//      cout<<endl;
      pr("%d\n", ps[n]);
   }

   return 0;
}