#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define sz(a) a.size()
#define en '\n'
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;
const int inf = 2e9;
const ll linf = 4e18;
int n,c,q;
string sss;
vector<int> s;
int dp[maxn][2];
int vi[maxn][2];
int f(int pos, int st)
{
    if(pos==n)return 0;
    if(vi[pos][st])return dp[pos][st];
    vi[pos][st]=1;
    if(!st){
        if(!s[pos]){
            return dp[pos][st] = min(f(pos+1,0),f(pos+1,1)+c);
        }
        else {
            return dp[pos][st] = min(f(pos+1,0)+1,f(pos+1,1)+c+1);
        }
    }
    if(!s[pos]){
        return dp[pos][st] = min(f(pos+1,0)+1,f(pos+1,1)+1);
    }
    return dp[pos][st] = min(f(pos+1,0),f(pos+1,1));
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);
    cin>>n>>c>>q>>sss;
    s.resize(n);
    for (int i=0;i<n;i++)s[i]=(int)(sss[i]-'0');
    if(c==n){
        if(n<=4000&&q<=4000){
            while (q--){
                int l,r;
                cin>>l>>r;
                l--,r--;
                for (int i=l;i<=r;i++)s[i]^=1;
                int ans = 0;
                for (int i=0;i<n;i++)if(s[i]==1)ans++;
                cout<<ans<<en;
            }
            return 0;
        }
        int ans = 0;
        for (int i=0;i<n;i++)if(s[i]==1)ans++;
        while (q--){
            int l,r;
            cin>>l>>r;
            l--,r--;
            for (int i=l;i<=r;i++){
                s[i]^=1;
                if (!s[i])ans--;
                else ans++;
            }
            cout<<ans<<en;
        }
        return 0;
    }
    while(q--){
        int l,r;
        cin>>l>>r;
        l--; r--;
        for (int i=l;i<=r;i++)s[i]^=1;
        for (int i=0;i<n;i++){dp[i][0] = dp[i][1] = 0; vi[i][0] = vi[i][1] = 0;}
        if(!s[0])cout<<f(0,0);
        else cout<<min(f(0,0),f(0,1)+c);
        cout<<en;
    }
    return 0;
}