#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, c, q, bn = 0, bj = 0, cena = 0;
    cin>>n>>c>>q;
    char s[n];
    int mat[q][2];
    for(int i = 0; i < n; i++)
    {
        s[i] = getchar();
    }

    for(int i = 0; i < q;i++)
    {
        cin>>mat[i][0];
        cin>>mat[i][1];
    }

    for(int j = 0; j < q;j++)
    {
        cena = 0;
        bn = 0;
        bj = 0;
        for(int k = mat[j][0]-1; k < mat[j][1]; k++)
        {
            if(s[k] == '0')
                s[k] = '1';
            else
                s[k] = '0';
        }
    for(int i = 0; i < n; i++)
    {
        if(s[i] == '0' && bn == 1)
            {
                if(bj >= c+1)
                    cena += c+1;
                else
                    cena += bj;
                bj = 0;
                bn = 0;
            }
        else
        {
            if(s[i] == '1')
                bj++;
            else
                bn++;

        }

        if(i == n-1 && bj != 0)
        {
            if(bj >= c)
                cena += c+1;
            else
                cena += bj;
        }
    }
    cout<<cena<<"\n";
    }

}